Tim
Tim

Reputation: 4671

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 :/

Upvotes: 0

Views: 206

Answers (1)

Tim
Tim

Reputation: 4671

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

Upvotes: 0

Related Questions