-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
First off all, love idea and the great talks about it on ReactEurope. But I still get stuck quite a lot (which I should expect from a technical preview). Here is my current problem:
My data is modeled like this:
type Babushka {
id: !String,
name: !String,
babushkas: [Babushka]
}
Now I want to display a Babushka list for which I have a List and a ListItem Component:
list.js
class BabushkaList extends Component {
render() {
return <ul>{this.props.babushka.babushkas.map(b => <BabushkaListItem babushka={b}/>)}</ul>;
}
}
export default Relay.createContainer(BabushkaList, {
fragments: {
babushka: () => Relay.QL`
fragment on Babushka {
babushka {
${BabushkaListItem.getFragment('babushka')}
}
}
`
}
});
list-item.js
class BabushkaListItem extends Component {
render() {
return (
<li onClick={this.onClick.bind(this)}>
{this.props.babushka.name}
<ul><BabushkatList babushka={this.props.babushka}</ul>
</li>
);
}
}
export default Relay.createContainer(BabushkaListItem, {
fragments: {
babushka: () => Relay.QL`
fragment on Babushka{
name,
${BabushkaList.getFragment('babushka')}
}
`
}
});
Naturally this leads to the stack size being exceeded. Am I doing something wrong fragment wise?
fred7BF, nicosayer, davincif and Yelmuffred7BFfred7BF
Metadata
Metadata
Assignees
Labels
No labels