Skip to content

Instantly share code, notes, and snippets.

@ilyamkin
Created November 1, 2019 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyamkin/5d5b20cfd7910cb2ef2b445b5d6b7e89 to your computer and use it in GitHub Desktop.
Save ilyamkin/5d5b20cfd7910cb2ef2b445b5d6b7e89 to your computer and use it in GitHub Desktop.
Load on click
const App = () => {
const [prefetchedIndexes, setPrefetchedIndexes] = useState();
return (
<>
<button
onClick={() => {
setPrefetchedIndexes(prefetchQuery(`${API}/majors-indexes`));
}}
>
Load all indexes
</button>
{prefetchedIndexes && (
<IndexList prefetchedIndexes={prefetchedIndexes} />
)}
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment