Lazy loading (and preloading) components in #react 16.6
▻https://hackernoon.com/lazy-loading-and-preloading-components-in-react-16-6-804de091c82d?source
React 16.6 adds a new feature that makes code splitting easier: React.lazy().Let’s see how and why to use this feature with a small demo.We have an app that shows a list of stocks. When you click on one stock it shows you a chart:Try itThat’s all it does. You can read the full code in the github repo (also check the pull requests to see the diffs and a running version of the app for each change we’ll do).For this post, we only care about what’s in the App.js file:▻https://medium.com/media/3e885e631886bae1a1c17731c60c2035/hrefWe have an App component that receives a list of stocks and shows a <StockTable/>. When a stock is selected from the table, the App component shows a <StockChart/> for that stock.What’s the problem? Well, we want our app to be blazing fast and show the (...)
#programming #web-development #javascript #front-end-development