From 27eb1c6a387bbb5518a840485465e6237e95e358 Mon Sep 17 00:00:00 2001 From: thiery Date: Fri, 3 Jan 2020 16:27:00 +0100 Subject: [PATCH] do not pass dataProvider directly to setState as it can be a function --- examples/demo/src/App.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/demo/src/App.tsx b/examples/demo/src/App.tsx index b5672e6766c..37b3d714409 100644 --- a/examples/demo/src/App.tsx +++ b/examples/demo/src/App.tsx @@ -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 ); };