Skip to content

Instantly share code, notes, and snippets.

@Debdut
Created September 20, 2022 07:26
Show Gist options
  • Save Debdut/4e3b97073cf4f2425d9e87e81a20bb48 to your computer and use it in GitHub Desktop.
Save Debdut/4e3b97073cf4f2425d9e87e81a20bb48 to your computer and use it in GitHub Desktop.
const Reducer = (
{ search, autocomplete }: InitialStateType,
action: SearchAction | AutoCompleteAction
) => ({
search: SearchReducer(search, action as SearchAction),
autocomplete: AutoCompleteReducer(autocomplete, action as AutoCompleteAction)
});
const [state, dispatch] = useReducer(Reducer, InitialState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment