-
-
Save Nio-o/4ca3992fd1cb62c3330bb51eb52b017f to your computer and use it in GitHub Desktop.
Revisions
-
milankorsos revised this gist
Aug 15, 2017 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,4 @@ import {Action, ActionCreator, Dispatch} from 'redux'; import {ThunkAction} from 'redux-thunk'; // Redux action -
milankorsos revised this gist
Aug 14, 2017 . No changes.There are no files selected for viewing
-
milankorsos revised this gist
Aug 14, 2017 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ // Import ActionCreator and Dispatch from react-redux instead of redux import {ActionCreator, Dispatch} from 'react-redux'; import {Action} from 'redux'; import {ThunkAction} from 'redux-thunk'; // Redux action const reduxAction: ActionCreator<Action> = (text: string) => { -
milankorsos revised this gist
Aug 14, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,6 +31,6 @@ const asyncThinkAction: ActionCreator< type: SET_TEXT, text }); } catch (e) {} }; }; -
milankorsos revised this gist
Aug 14, 2017 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,8 +24,9 @@ const thunkAction: ActionCreator<ThunkAction<Action, IState, void>> = ( const asyncThinkAction: ActionCreator< ThunkAction<Promise<Action>, IState, void> > = () => { return async (dispatch: Dispatch<IState>): Promise<Action> => { try { const text = await Api.call(); return dispatch({ type: SET_TEXT, text -
milankorsos created this gist
Aug 14, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ import {Action, ActionCreator, Dispatch} from 'redux'; // Redux action const reduxAction: ActionCreator<Action> = (text: string) => { return { type: SET_TEXT, text }; }; // Redux-Thunk action const thunkAction: ActionCreator<ThunkAction<Action, IState, void>> = ( text: string ) => { return (dispatch: Dispatch<IState>): Action => { return dispatch({ type: SET_TEXT, text }); }; }; // Async Redux-Thunk action const asyncThinkAction: ActionCreator< ThunkAction<Promise<Action>, IState, void> > = () => { return (dispatch: Dispatch<IState>): Promise<Action> => { return Api.call().then(text => { return dispatch({ type: SET_TEXT, text }); }); }; };