Last active
          April 12, 2020 14:15 
        
      - 
      
- 
        Save 22mahmoud/eda387743c93ac8d2d4f65bd9c101036 to your computer and use it in GitHub Desktop. 
Revisions
- 
        22mahmoud revised this gist Apr 12, 2020 . 1 changed file with 5 additions and 24 deletions.There are no files selected for viewingThis 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,34 +1,15 @@ const playerMachine = Machine({ id: 'player', initial: 'loading', states: { loading: { on: { } }, } }); 
 
- 
        22mahmoud revised this gist Apr 12, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewingThis 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,5 +1,5 @@ const playerMachine = Machine({ id: 'player', initial: 'idle', context: { retries: 0 
- 
        22mahmoud created this gist Apr 12, 2020 .There are no files selected for viewingThis 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,34 @@ const fetchMachine = Machine({ id: 'fetch', initial: 'idle', context: { retries: 0 }, states: { idle: { on: { FETCH: 'success' } }, loading: { on: { RESOLVE: 'success', REJECT: 'failure' } }, success: { type: 'final' }, failure: { on: { RETRY: { target: 'loading', actions: assign({ retries: (context, event) => context.retries + 1 }) } } } } });