Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Duplicate declaration "decorators" #150

Open
SurjitNingombam opened this issue Nov 2, 2018 · 0 comments
Open

Duplicate declaration "decorators" #150

SurjitNingombam opened this issue Nov 2, 2018 · 0 comments

Comments

@SurjitNingombam
Copy link

When I tried to follow the instructors in the readme file to create custom decorators, I am getting this error. Can someone tell me the right approach as the one mentioned in the readme seems wrong!

Here is the code:
const decorators = { Header: (props) => { return ( <div style={props.style}> {props.node.name} </div> ); } }; class TreeExample extends React.Component { constructor(props){ super(props); this.state = {}; this.onToggle = this.onToggle.bind(this); } onToggle(node, toggled){ if(this.state.cursor){this.state.cursor.active = false;} node.active = true; if(node.children){ node.toggled = toggled; } this.setState({ cursor: node }); } render(){ return ( <Treebeard data={data} onToggle={this.onToggle} decorators={decorators} /> ); } }

No issue with the data, my data is a big json so, not sharing here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant