concurrent mode
play

Concurrent mode Prabashwara Seneviratne (bash) Before we start - PowerPoint PPT Presentation

Building responsive web apps with Concurrent mode Prabashwara Seneviratne (bash) Before we start Disclaimers In a nutshell What is it? For react, this the ability to work on multiple state updates at the same time Incremental Adoption


  1. Building responsive web apps with Concurrent mode Prabashwara Seneviratne (bash)

  2. Before we start Disclaimers

  3. In a nutshell What is it? For react, this the ability to work on multiple state updates at the same time

  4. Incremental Adoption Legacy Mode Concurrent Mode ReactDOM.render(<App />, rootNode) ReactDOM.createRoot(rootNode).render(<App />) Blocking Mode ReactDOM.createRoot(rootNode).render(<App />)

  5. Introducing PackagePile A JS framework aggregator to keep track of all the JS frameworks created everyday

  6. Problem #1 The waterfall

  7. Problem #1 In code Then the cards will render and start fetching their data Detail page fetches its data first

  8. Problem #1 In action

  9. Previously on React 16.6 Lazy & Suspense Split javascript code into multiple files so that only what is required by the client would be downloaded

  10. Coming up: the all new, fully extended Suspense Components can use special loaders which will start running straightaway, regardless of the structure

  11. The new suspense In action

  12. The Ideal solution

  13. Problem #2 The jump The app changes state instantly - which leads to an ugly loading spinner while next data loads

  14. The new solution useTransition useTransition lets you show the current state while react works on the next one in the background

  15. withTransition In action

  16. Time for Bad news The “unsafe” lifecycle methods are really unsafe now ReactDOM.findDOMNode(component) Old context API, string refs and findDOMNode are dead

  17. That’s it bash2/package-pile @MewsDevs https://developers.mews.com me@bash.lk

Recommend


More recommend