Search code examples
reactjsflux

Flux Utils MapStore


Do I have to manually define my initial state as an immutable map when using Flux's MapStore Util. Or can I return an object and it'll internally make that into an immutable map ?

ie.

getInitialState() {

    return Immutable.fromJS({
       hello: Ted
    });
}

vs

getInitialState() {

    return {
       hello: Ted
    };
}

I'm halfway into a project with the later, and have just realised that my state thinks its changing more than it is :/


Solution

  • Yep, turns out its up to you to return an Immutable.Map in the getInitialState function.