简体   繁体   中英

React Native - cache DOM?

I have a component in React Native that needs to render pretty big array. That array is an in memory object and it takes about one second to render whole view.

So it's not a big deal when the app is showing up but there are couple of other screens that user can navigate to and when he navigates back it takes again around one second to render that view. And that's pretty annoying.

Is there any way I could render a component once and keep it in some cache or something? So that when user navigates out and get's back to this view it will be shown immidiately?

Thanks in advance.

I'd suggest rendering in chunks of size n (whatever gives you best-perceived performance) instead of rendering the entire 250 item list.

Did some more digging on caching react views and found this https://github.com/zhaoyao91/react-view-cache . Haven't tried it myself but maybe it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM