Closed perryf closed 7 years ago
@perryf Yes, that is a good way to do this. It also preserves context, which, since we're using this
, is important. One tip though is that you don't need the second set of brackets:
<button onClick={(e) => this.start(this.state.synth)}>Start</button>
As for the service worker, it is handling caching and other non-core functionality. Here's an interesting article that goes into more depth: https://medium.com/@addyosmani/progressive-web-apps-with-react-js-part-3-offline-support-and-network-resilience-c84db889162c
cool, thats Andy!
is the best ways to pass variables into a function that's attached to an element to pass them into an anonymous function? If I just write the function with the variable passed in, it will automatically call it.
So here, passing
this.state.synth
intothis.start
function, this is the best way without auto calling the function when the page loads?Also, what does
registerServiceWorker();
do?