Update InteropWithReact.md for "Don’t Use HOCs Inside the render Method"

This commit is contained in:
boxp 2018-12-09 04:41:25 +09:00
parent 4285ca1fe5
commit c873aed5ea
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: