Creating State
Introduction
Conan.light
const yetAnotherCounter$ = Conan.light('counter', 0)Conan.state
Guidelines
Demo
Last updated
Was this helpful?
Was this helpful?
export const todoListSyncState$ = Conan.state({
name: 'todos-sync',
initialData: {
appliedFilter: VisibilityFilters.SHOW_ALL,
todos: []
},
reducers: getState=>({
$addTodo: (todo) => ({
todos: [...getState().todos, todo],
appliedFilter: getState().appliedFilter
})
}),
});export const repoDetailsState$: RepoDetailsState = Conan.state<RepoDetailsData>({
name: 'repo-details',
initialData: {openIssuesCount: -1, error: null},
reducers: repoDetailsReducersFn,
actions: repoDetailsActionsFn
});