Closed dagostinelli closed 6 years ago
Why would you need that?
Now .init()
is the actual constructor()
, you can move everything you have from your .init()
to the constructor()
In your case, this:
{
super();
this.state = {some_text: "text is not loaded yet"};
this.listenables = Actions;
}
init()
{
alert('hi');
this.reload();
}
reload()
{
// go to server and get some_text
//this.state.some_text = "hello, world";
this.setState({some_text: "hello, world"});
}
Would look like this:
{
super();
alert('hi');
this.state = {some_text: "hello, world"};
this.listenables = Actions;
}
Or trigger directly the function that grabs data from the server, there...
In the past, we could put an init function on a store and it would fire automatically for us. I can't get it to do that now. Here's some code. What is the new way to do this?