How to use the react-suspense-fetch.run function in react-suspense-fetch

To help you get started, we’ve selected a few react-suspense-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dai-shi / react-suspense-fetch / examples / 03_props / src / Item.tsx View on Github external
const Item: React.FC = ({ id, result }) => {
  run(result, id); // only effective for the first render
  return (
    <div>
      User ID: {id}
      
    </div>
  );
};
github dai-shi / react-suspense-fetch / examples / 04_auth / src / UserData.tsx View on Github external
const UserData: React.FC = () =&gt; {
  const [authState] = useContext(AuthContext);
  if (!authState) throw new Error('no authState');
  run(UserItems, authState);
  return (
    <ul>
      {UserItems.data.map((item) =&gt; (
        <li>{item.name}</li>
      ))}
    </ul>
  );
};

react-suspense-fetch

A low-level library for React Suspense for Data Fetching

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis