Skip to content

setState from streaming worker thread? #145

@evbo

Description

@evbo

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions