Skip to content

Commit

Permalink
do not pass dataProvider directly to setState as it can be a function
Browse files Browse the repository at this point in the history
  • Loading branch information
ThieryMichel committed Jan 3, 2020
1 parent 4fd9473 commit 27eb1c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ const App = () => {
restoreFetch = await fakeServerFactory(
process.env.REACT_APP_DATA_PROVIDER
);

const dataProviderInstance = await dataProviderFactory(
process.env.REACT_APP_DATA_PROVIDER
);
setDataProvider(
await dataProviderFactory(process.env.REACT_APP_DATA_PROVIDER)
// GOTCHA: dataProviderInstance can be a function
() => dataProviderInstance
);
};

Expand Down

0 comments on commit 27eb1c6

Please sign in to comment.