Skip to content

Instantly share code, notes, and snippets.

@keshidong
Last active October 18, 2019 04:00
Show Gist options
  • Select an option

  • Save keshidong/aa69ae93d8054848e71cd4d9a06fe8db to your computer and use it in GitHub Desktop.

Select an option

Save keshidong/aa69ae93d8054848e71cd4d9a06fe8db to your computer and use it in GitHub Desktop.
export default ({ onChange, sessionId }) => {
const onChangeStablize = useStableCallback(onChange)
useEffect(() => {
fetch(`/api/v1/session/${sessionId}`)
.then(async (response) => {
if (response.status === 200) {
const data = await response.json()
onChangeStablize(data)
}
})
}, [sessionId])
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment