Created
April 2, 2021 20:48
-
-
Save westwick/2d6aed116b1f31cf07d8a2df8ad773d9 to your computer and use it in GitHub Desktop.
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
export const SomeComponent = (props) => { | |
const [searchWorker, setSearchWorker] = useState(new SearchWorker()); | |
useEffect(() => { | |
// subscribe to worker messages | |
searchWorker.onmessage(...); | |
// do something with the worker on component init | |
searchWorker.postMessage(...); | |
}, []); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment