So far every question I can find about async rendering involves an AJAX call.
I've got a text input in my React app, which you can type into to filter a big list of items rendered underneath. Of course, as this list gets bigger, it gets more expensive, so typing into the search box is slow and laggy.
Is there a way to render the list asynchronously from the text input? Or somehow else have it on a separate thread? I don't really want to turn this into a remote AJAX request just because it's too pricy to render - I have all the data I need already.
Basically, my text input's onChange method points at handleChange
, then in each item's render()
function, it checks the hiddenBySearch
method to see if it should be displayed:
handleChange = value => {
this.setState({
searchValue: value
})
}
hiddenBySearch = item => {
if(this.props.data.hiddenBySearch){
return this.props.data.hiddenBySearch(item, this.state.searchValue)
}else{
return false
}
}
There's a little more to it but I'd say it's not relevant.
EDIT: It's not a possible duplicate of this post - I'm specifically asking about offsetting React's rendering. I'm fairly sure it's impossible to put this in a Web Worker.