I'm wondering how React.lazy
gonna improve performance in React-Native app.
const Warning = React.lazy(() => import('./Warning'));
...
render() {
return (
...
{
{this.state.count > 10 ? (
<React.Suspense fallback={null}>
<Warning />
</React.Suspense>
) : null}
}
)
}
I get to know the above dynamic loading webpack bundles in ReactJS side and I'm wondering if it's gonna help in React Native side?
Essentially we bundled all the JS code together and ship together to user device, all the JS code are already there, sitting in the user device. Wondering how React.lazy
gonna help improving performance, in which sense?
No definitely not. But it may improve your app's startup time. If you got many screens then your app startup time will go slow without lazy import. Check your app startup time without lazy import and after implementing the lazy import.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With