useDataClient
Example usage:
import { preloadData, useDataClient } from 'react-isomorphic-data';const Component = () => {const client = useDataClient();const handleClick = () => {preloadData(client, 'http://localhost:3000/rest-api');}return <div>Something</div>}
The returned value of useDataClient()
are:
client: DataClient
A
DataClient
instance, similar to what is created viacreateDataClient()
. Can be passed topreloadData
to implement render-as-you-fetch pattern