Connor McSheffrey
11 years ago
16 changed files with 33 additions and 31 deletions
@ -1,13 +1,15 @@ |
|||
--- |
|||
id: introduction |
|||
title: Introduction |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: introduction.html |
|||
next: inline-styles.html |
|||
--- |
|||
|
|||
The React cookbook provides common React tips, bite-sized information that can surprisingly answer lots of questions you might have had and warn you against common pitfalls. |
|||
The React tips section provides bite-sized information that can answer lots of questions you might have and warn you against common pitfalls. |
|||
|
|||
### Contributing |
|||
|
|||
Submit a pull request to the [React repo](https://github.com/facebook/react) following the cookbook entries' style. If you have a recipe that needs review prior to submitting a PR you can find help in the [#reactjs IRC on freenode](irc://chat.freenode.net/reactjs) or the [reactjs Google group](http://groups.google.com/group/reactjs). |
|||
Submit a pull request to the [React repo](https://github.com/facebook/react) following the cookbook entries' style. If you have a recipe that needs review prior to submitting a PR you can find help in the [#reactjs IRC on freenode](irc://chat.freenode.net/reactjs) or the [reactjs Google group](http://groups.google.com/group/reactjs). Also, check the [Tips Wiki][1] for entries in-progress and general guidelines on writing React tips. |
|||
|
|||
[1]: https://github.com/facebook/react/wiki/Tips-(Previously-Cookbook) |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: inline-styles |
|||
title: Inline Styles |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: inline-styles.html |
|||
next: if-else-in-JSX.html |
|||
prev: introduction.html |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: if-else-in-JSX |
|||
title: If-Else in JSX |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: if-else-in-JSX.html |
|||
prev: inline-styles.html |
|||
next: self-closing-tag.html |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: self-closing-tag |
|||
title: Self-Closing Tag |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: self-closing-tag.html |
|||
prev: if-else-in-JSX.html |
|||
next: maximum-number-of-jsx-root-nodes.html |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: maximum-number-of-jsx-root-nodes |
|||
title: Maximum Number of JSX Root Nodes |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: maximum-number-of-jsx-root-nodes.html |
|||
prev: self-closing-tag.html |
|||
next: style-props-value-px.html |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: children-props-type |
|||
title: Type of the Children props |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: children-props-type.html |
|||
prev: style-props-value-px.html |
|||
next: controlled-input-null-value.html |
@ -1,13 +1,13 @@ |
|||
--- |
|||
id: controlled-input-null-value |
|||
title: Value of null for Controlled Input |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: controlled-input-null-value.html |
|||
prev: children-props-type.html |
|||
next: componentWillReceiveProps-not-triggered-after-mounting.html |
|||
--- |
|||
|
|||
Specifying the `value` prop on a [controlled component](/react/docs/cookbook/forms.html) prevents the user from changing the input unless you desire so. |
|||
Specifying the `value` prop on a [controlled component](/react/docs/tips/forms.html) prevents the user from changing the input unless you desire so. |
|||
|
|||
You might have run into a problem where `value` is specified, but the input can still be changed without consent. In this case, you might have accidentally set `value` to `undefined` or `null`. |
|||
|
@ -1,12 +1,12 @@ |
|||
--- |
|||
id: componentWillReceiveProps-not-triggered-after-mounting |
|||
title: componentWillReceiveProps Not Triggered After Mounting |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: componentWillReceiveProps-not-triggered-after-mounting.html |
|||
prev: controlled-input-null-value.html |
|||
next: props-in-getInitialState-as-anti-pattern.html |
|||
--- |
|||
|
|||
`componentWillReceiveProps` isn't triggered after the node is put on scene. This is by design. Check out [other lifecycle methods](/react/docs/cookbook/component-specs.html) for the one that suits your needs. |
|||
`componentWillReceiveProps` isn't triggered after the node is put on scene. This is by design. Check out [other lifecycle methods](/react/docs/tips/component-specs.html) for the one that suits your needs. |
|||
|
|||
The reason for that is because `componentWillReceiveProps` often handles the logic of comparing with the old props and acting upon changes; not triggering it at mounting (where there are no old props) helps in defining what the method does. |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: props-in-getInitialState-as-anti-pattern |
|||
title: Props in getInitialState Is an Anti-Pattern |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: props-in-getInitialState-as-anti-pattern.html |
|||
prev: componentWillReceiveProps-not-triggered-after-mounting.html |
|||
next: dom-event-listeners.html |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: initial-ajax |
|||
title: Load Initial Data via AJAX |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: initial-ajax.html |
|||
prev: dom-event-listeners.html |
|||
next: false-in-jsx.html |
@ -1,7 +1,7 @@ |
|||
--- |
|||
id: false-in-jsx-tip |
|||
id: false-in-jsx |
|||
title: False in JSX |
|||
layout: cookbook |
|||
layout: tips |
|||
permalink: false-in-jsx.html |
|||
prev: initial-ajax.html |
|||
--- |
Loading…
Reference in new issue