File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import { store, actions } from "../store";
33
44export const useStore = ( ) => {
55 const { state, dispatch } = useContext ( store ) ;
6- const dispatchAction = ( action ) => dispatch ( action ) ;
6+
7+ const dispatchAction = ( action ) => action && dispatch ( action ) ;
78
89 return { state, dispatchAction, actions } ;
910} ;
Original file line number Diff line number Diff line change 1- import React , { useContext } from "react" ;
1+ import React from "react" ;
22import { useStore } from "../../hooks" ;
33
44const Login = ( ) => {
@@ -7,7 +7,7 @@ const Login = () => {
77 return (
88 < div >
99 < button
10- onClick = { ( ) => dispatchAction ( actions . setUserAuthenticated ( true ) ) }
10+ onClick = { ( ) => dispatchAction ( ) }
1111 >
1212 Authenticate
1313 </ button >
You can’t perform that action at this time.
0 commit comments