Skip to content

React and Immutable state #5

@ccorcos

Description

@ccorcos

Hey, so after reading a bunch about react and checking out Pete Hunt's react demo, it seems that React was built with the intention of "pure" components with immutable state. I think the only reason they included this.state is to deal with forms, validation, etc.

Anyways, the mixin you wrote makes a lot of sense from a meteor perspective and when combined with react gives more fine-grained re-rendering. However, now your react components have mutable state and they're no longer pure. This makes it hard to distinguish between a non-pure Player component that accepts a playerId and fetches the name and score. And a pure Player component that accepts a player object and renders the object's name and score.

Honestly, I'm uncomfortable with the pure version, but it seems that the beauty of react is this super fact reconciliation algorithm. Based on pete hunt's demo and his global autorun method, it seems they want you to treat react strictly as a rendering engine.

Anyways, I'm curious if you had any thoughts on this tradeoff...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions