-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about state and adding elements to the collection #19
Comments
Also, adding on top of your answer in VoliJS/NestedLink#12, state.getLink is undefined for me. I assume I need to render() {
const { state } = this;
const entriesLink = state.getLink( 'entries' );
return (
....
{
entriesLink.map((entryLink, key) => <li key={key}>{entryLink.value.name}</li>)
}
} Edit: The following is defined, but it doesn't return anything even though I added an entry to the collection? I think the documentation on the front page needs to be updated.
|
I also tried not using classes with React.createClass and Model.extend per the examples and I get 'use strict';
import React from 'nestedreact';
import { Entry } from '../models/Entry.js';
export const Home = React.createClass({
state: {
entries: Entry.Collection
},
render() {
return (
<div>
<div>
<h2>HOME TEST</h2>
</div>
</div>
);
}
}); 'use strict';
import React from 'nestedreact';
import { Model } from 'nestedtypes';
export const Entry = Model.extend({
defaults: {
name: "default_name"
}
}); |
You forgot
|
.createClass and .extend work without @define, of course. I will check your example locally. |
Your last example works perfectly in Chrome. Try to take any of the examples from examples folder (except flux_comparison) as starting boilerplate for your test. |
Thank you for the replies, I didn't even know that decorators existed in javascript, hahah. I will try this when I have the time and let you know, we are quite busy at work right now |
I have this bit of code based on what I can tell from the TODOMVC is the right way to define state
In the console when debugging (eg in render or in constructor) I notice
this.state.entries.add
does not exist.this.state.entries.create().add
is defined. What would be the proper way to add something to the entries collection? Should I declareinstead?
The text was updated successfully, but these errors were encountered: