Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 768 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 768 Bytes

React Suspense & Lazy import example

This project uses React 16 Suspense and lazy imports (briefly explained here) to make a simple tv show search app.

The idea is to stop pushing data fetching up into containers, and recouple data fetching with the components that actually use it.

The "greppable" techniques in this project are:

  • React.Suspense - a HOC that handles a fallback component when data (or a lazy component) are loading
  • React.lazy - wraps a function returning a component dynamically imported
  • unstable_createResource - a caching mechanism that takes a function with an id as a parameter returning a promise. It also can block rendering on a component wrapped in React.Suspense