optimizely / nuclear-js

Reactive Flux built with ImmutableJS data structures. Framework agnostic.
https://optimizely.github.io/nuclear-js/
MIT License
2.23k stars 141 forks source link

Data Bindings as Props instead of State #199

Closed gf3 closed 8 years ago

gf3 commented 8 years ago

Earlier I was running into some issues where I wanted to update some state in response to a data binding change however this difficult to do cleanly in React. It got me thinking that perhaps data bindings would be better suited as props on a component vs. state; especially given the immutable nature of nuclear-js. I think it also makes sense in that the components don't really own the data bindings they're connected to and can't explicitly update them anyway. Thoughts on this approach? I'd be happy to take a stab at this over the break if you guys think it has merit.

raulmatei commented 8 years ago

Hi,

Probably you're using ReactMixin, see NuclearJS React Addons and nuclearComponent HoC, it passes the data bindings as props to the child component.

Raul.

gf3 commented 8 years ago

Ahh, very nice, thank you.

raulmatei commented 8 years ago

You're welcome.