diff --git a/README.md b/README.md index 53f4639..cc9fe83 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ import reactTreeWalker from 'react-tree-walker'; class Foo extends React.Component { constructor(props) { super(props); - this.getValue = this.getValue.bind(this); + this.getData = this.getData.bind(this); } getData() { @@ -84,15 +84,15 @@ function visitor(element, instance, context) { // prevent traversing "4"'s children ? false : true - } }) } return true -}; +} -reactTreeWalker(app, visitor); +reactTreeWalker(app, visitor).then(() => { + console.log(values); // [1, 2, 4, 3]; +}); -console.log(values); // [1, 2, 4, 3]; ``` ## FAQs