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";
3
3
4
4
export const useStore = ( ) => {
5
5
const { state, dispatch } = useContext ( store ) ;
6
- const dispatchAction = ( action ) => dispatch ( action ) ;
6
+
7
+ const dispatchAction = ( action ) => action && dispatch ( action ) ;
7
8
8
9
return { state, dispatchAction, actions } ;
9
10
} ;
Original file line number Diff line number Diff line change 1
- import React , { useContext } from "react" ;
1
+ import React from "react" ;
2
2
import { useStore } from "../../hooks" ;
3
3
4
4
const Login = ( ) => {
@@ -7,7 +7,7 @@ const Login = () => {
7
7
return (
8
8
< div >
9
9
< button
10
- onClick = { ( ) => dispatchAction ( actions . setUserAuthenticated ( true ) ) }
10
+ onClick = { ( ) => dispatchAction ( ) }
11
11
>
12
12
Authenticate
13
13
</ button >
You can’t perform that action at this time.
0 commit comments