Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setState from streaming worker thread? #145

Open
evbo opened this issue Sep 18, 2022 · 0 comments
Open

setState from streaming worker thread? #145

evbo opened this issue Sep 18, 2022 · 0 comments

Comments

@evbo
Copy link

evbo commented Sep 18, 2022

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:
#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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant