Import XLSX file in React app with redux-sagas

There’s two problems here conceptually:

  • yield importFile() is going to pass undefined to the saga middleware, which will presumably keep right on going
  • The file reader will not execute the callback right away, and your code really needs to wait until it’s done.

You’ll need to restructure the code so that it waits until the reader logic is done.

One option might to be to manually create a Promise inside of importFile and return it, and resolve the promise at the end of the .onload callback.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top