Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Call A Function From onClick in React

This is an example of how to call a function from onClick in react to update the state of an item :

jsx
const [pageFetchInProgress, setPageFetchInProgress] = React.useState(false)

<button onClick={() => setPageFetchInProgress(true)}>Check Status</button>

This is the fix for this which would start an infinite loop which react kills :

jsx
<button onClick={setPageFetchInProgress(true)}>Check Status</button>