Created
November 1, 2019 17:09
-
-
Save ilyamkin/5d5b20cfd7910cb2ef2b445b5d6b7e89 to your computer and use it in GitHub Desktop.
Load on click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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