Skip to content

Commit

Permalink
docs: 📚️ fix redux-toolkit docs (react-boilerplate#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
alifarooq0 authored and mogsdad committed Oct 2, 2020
1 parent 8962e55 commit cb67ec5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/building-blocks/redux-toolkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ import { sliceKey, reducer, actions } from './slice';
import { selectUsername } from './selectors';

export function HomePage() {
// Used to dispatch slice actions
const dispatch = useDispatch();

// Inject the slice to redux
useInjectReducer({ key: sliceKey, reducer: reducer });

Expand All @@ -112,7 +115,7 @@ export function HomePage() {

const textInputChanged = evt => {
// Trigger the action to change the state. It accepts `string` as we declared in `slice.ts`. Fully type-safe ✅
actions.changeUsername(evt.target.value);
dispatch(actions.changeUsername(evt.target.value));
};
// ...
}
Expand Down

0 comments on commit cb67ec5

Please sign in to comment.