I dont understand how the following code is getting called and how it works ! ?
What is interval doing here and what do these below methods do ?
how are they invoked here in this code ?
it automatically calls these three methods, in order
ReactJS is handling this methods call when you mount a component, you can use this to your advantage when designing your app.
Impossible to say what exactly interval is without knowing where the example is coming from
componentDidMount is called when a component is rendered for the first time, so this is a good place to start an interval (to start an update cycle to update the element every 5 seconds)
then when the component is removed, componentWillUnmount is called, you clear the interval