Closed dtothefp closed 9 years ago
provideReactor is there for that =). It's a HoC where you send the reactor as a prop, and it inject it into react context to get picked up by the mixin or the nuclearComponent. In your case, simply
@provideReactor
export default class App extends React.Component {
...
}
or
import App from './components/App';
const WrappedApp = provideReactor(App);
React.render(
<WrappedApp reactor={reactor} />,
document.getElementById('app')
);
Both the nuclear mixin and component expect a reactor to be present on the reactor key of react context. Maybe I should have been clearer about that in the readme.
nvm, saw your tests using @provideReactor
and @nuclearComponent
in combo...duh
@Sinewyk
check this out https://gist.github.com/dtothefp/a8bed4dc372fc2766fcb this is how I used React.cloneElement
to add props to child inputs and transfer their data to the form level, not sure if this is a hack or not?
I could use advice on the getters and the stores and where I should be performing validation logic i.e. in the store or in the component. It's all loosely based off this guy's writeup who is doing all validation in the component.
http://christianalfoni.github.io/javascript/2014/10/22/nailing-that-validation-with-reactjs.html
Example is here https://github.com/dtothefp/nuclear-decorator. Maybe I'm doing something stupid but if I
I get the error
Uncaught TypeError: Cannot read property 'evaluate' of undefined
.If in
nuclearComponent.js
line 42 I changeIs there some way I should be binding the Reactor to the component context that I'm not aware of?