minor cleanup

This commit is contained in:
Alan Thompson 2018-11-05 14:26:50 -08:00 committed by GitHub
parent d9057eaecf
commit 3d31b348a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -128,13 +128,13 @@ Some React components expect a function as their only child. React autosizer is
## Getting props and children of current component
Because you just pass argument to reagent functions, you typically don't need to think about "props" and "children" as distinct things. But reagent does make a distinction and it is helpful to understand this particularly when interoperating with native elements and React libraries.
Because you just pass arguments to reagent functions, you typically don't need to think about "props" and "children" as distinct things. But Reagent does make a distinction and it is helpful to understand this, particularly when interoperating with native elements and React libraries.
Specifically, if the first argument to your reagent function is a map, that is assigned to `this.props` of the underlying reagent component. All other arguments are assigned as children to `this.props.children`.
Specifically, if the first argument to your Reagent function is a map, that is assigned to `this.props` of the underlying Reagent component. All other arguments are assigned as children to `this.props.children`.
When interacting with native React components, it may be helpful to access props and children, which you can do with `reagent.core/current-component`. This function returns an object that allows you retrieve the props and children passed to the current component.
Beware that `current-component` is only valid in component functions, and must be called outside of e.g event handlers and for expressions, so its safest to always put the call at the top, as in `my-div` here:
Beware that `current-component` is only valid in component functions, and must be called outside of e.g event handlers and `for` expressions, so its safest to always put the call at the top, as in `my-div` here:
```clojure
(ns example