Skip to content

Commit 4fafc3e

Browse files
authored
chore: special handling of arrays (#110)
* fix: special handling of arrays * chore: lint * chore: rename
1 parent abf623e commit 4fafc3e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/todos/src/models/todos.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ const model = {
2424
remove(state: TodosState, index: number) {
2525
state.splice(index, 1);
2626
},
27+
set(state: TodosState, nextState: TodosState) {
28+
return nextState;
29+
},
2730
},
2831
effects: () => ({
2932
async refresh() {
3033
await delay(2000); // wait for data to load
3134

3235
// pass the result to a local reducer
33-
this.setState([
36+
this.set([
3437
{
3538
text: 'react',
3639
},

0 commit comments

Comments
 (0)