stylejy / Jamming-Feature-Request

Jamming application for Spotify
0 stars 0 forks source link

Init Function #2

Open farishkash opened 6 years ago

farishkash commented 6 years ago

https://github.com/stylejy/Jamming-Feature-Request/blob/0fec18e3551650064e2656751de3d9d8fc4f8777/src/App.js#L19

In react it is consider a better practice to use componentDidMount to trigger this function

https://reactjs.org/docs/react-component.html#componentdidmount

If you look at the constructor information about this section you can see your this.init can lead to side effects. For myself I can see this causing additional renders.

I would also think it might be cleaner to the init code to the Spotify.js file and then just call Spotify.init()

stylejy commented 6 years ago

Init function moved to Spotify.js.