Merge pull request #415 from boxp/update-example-for-dont-use-hocs-inside-the-render-method

Fix InteropWithReact.md for "Don’t Use HOCs Inside the render Method"
This commit is contained in:
Juho Teperi 2018-12-09 10:49:50 +02:00 committed by GitHub
commit 5381c41b3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -94,11 +94,10 @@ Note:
Some React libraries use the decorator pattern: a React component which takes a component as an argument and returns a new component as its result. One example is the React DnD library. We will need to use both `adapt-react-class` and `reactify-component` to move back and forth between React and reagent:
```clojure
(defn react-dnd-component
[]
(def react-dnd-component
(let [decorator (DragDropContext HTML5Backend)]
[(reagent/adapt-react-class
(decorator (reagent/reactify-component top-level-component)))]))
(reagent/adapt-react-class
(decorator (reagent/reactify-component top-level-component)))))
```
This is the equivalent javascript: