add reducer
This commit is contained in:
parent
3c78f34d5b
commit
46b0565819
@ -50,4 +50,8 @@ export class Updux<TState extends any = {}, TActions extends { [key: string]: Ac
|
||||
R.mapValues(this.#subduxes, ({ initial }) => initial),
|
||||
);
|
||||
}
|
||||
|
||||
get reducer() {
|
||||
return (state, action) => state;
|
||||
}
|
||||
}
|
||||
|
11
src/reducer.test.ts
Normal file
11
src/reducer.test.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { test, expect } from 'vitest';
|
||||
|
||||
import { Updux } from './Updux.js';
|
||||
|
||||
test('basic reducer', () => {
|
||||
const dux = new Updux({});
|
||||
|
||||
expect(dux.reducer).toBeTypeOf('function');
|
||||
|
||||
expect(dux.reducer({ a: 1 }, { type: 'foo' })).toMatchObject({ a: 1 }); // noop
|
||||
});
|
Loading…
Reference in New Issue
Block a user