Data Fetching + React 18 Streaming Demos
Client Side Fetching Demo
This page's data is fetched on the client side. The server returns html and JS that hydrates the component and runs the effects that fetch the data
The date is: Initial state
Client side loaded
The data is fetched via standard React data fetching, using useEffect hooks to call async functions to fetch the data
const Component = () => {
const [state, setState] = useState({ results: undefined });
useEffect(() => setState(await fetchData()), []);
return <Component data={state.results}/>
}