react-papaparse icon indicating copy to clipboard operation
react-papaparse copied to clipboard

setState from streaming worker thread?

Open evbo opened this issue 3 years ago • 0 comments

Hi,

all of the examples discussed in this prior issue log the step results to the console, but how could you store the stream as state to a react component instead of just logging it?

Examples in prior issue about how to stream: https://github.com/Bunlong/react-papaparse/issues/59

Example in docs: https://github.com/Bunlong/react-papaparse/blob/d159bc5cfb6f40e63e4ddf5937ef7df5bdb93a8e/docs/src/components/screens/indexes/Worker.js

The reason I ask is because this is running in a separate thread, which requires window listeners to post results back to the main rendering thread doesn't it? Does this library (plan to) handle that?

For example, here's how it could be done: https://bokandp.medium.com/web-workers-with-react-ad495bd11e8b https://www.newline.co/fullstack-react/articles/introduction-to-web-workers-with-react/

evbo avatar Sep 18 '22 16:09 evbo