Browse Source

Renamed Cookbook references to tips. Reworded intro (sounded weird because it still referenced cookbooks. Updated some entry ID's (some side nav links didn't match entry permalinks)

main
Connor McSheffrey 11 years ago
parent
commit
b8c7f3cdfd
  1. 8
      _config.yml
  2. 6
      _includes/nav_docs.html
  3. 6
      _layouts/tips.html
  4. 8
      tips/01-introduction.md
  5. 2
      tips/02-inline-styles.md
  6. 2
      tips/03-if-else-in-JSX.md
  7. 2
      tips/04-self-closing-tag.md
  8. 2
      tips/05-maximum-number-of-jsx-root-nodes.md
  9. 6
      tips/06-style-props-value-px.md
  10. 2
      tips/07-children-props-type.md
  11. 4
      tips/08-controlled-input-null-value.md
  12. 4
      tips/09-componentWillReceiveProps-not-triggered-after-mounting.md
  13. 2
      tips/10-props-in-getInitialState-as-anti-pattern.md
  14. 4
      tips/11-dom-event-listeners.md
  15. 2
      tips/12-initial-ajax.md
  16. 4
      tips/13-false-in-jsx.md

8
_config.yml

@ -69,8 +69,8 @@ nav_docs_sections:
title: Event System
- id: dom-differences
title: DOM Differences
nav_cookbook:
- title: Cookbook
nav_tips:
- title: Tips
items:
- id: introduction
title: Introduction
@ -80,7 +80,7 @@ nav_cookbook:
title: If-Else in JSX
- id: self-closing-tag
title: Self-Closing Tag
- id: jsx-root-node-count
- id: maximum-number-of-jsx-root-nodes
title: Maximum Number of JSX Root Nodes
- id: style-props-value-px
title: Shorthand for Specifying Pixel Values in style props
@ -90,7 +90,7 @@ nav_cookbook:
title: Value of null for Controlled Input
- id: componentWillReceiveProps-not-triggered-after-mounting
title: componentWillReceiveProps Not Triggered After Mounting
- id: props-in-getInitialSate-as-anti-pattern
- id: props-in-getInitialState-as-anti-pattern
title: Props in getInitialState Is an Anti-Pattern
- id: dom-event-listeners
title: DOM Event Listeners in a Component

6
_includes/nav_docs.html

@ -26,14 +26,14 @@
</div>
{% endfor %}
<!-- Cookbook Nav -->
{% for section in site.nav_cookbook %}
<!-- Tips Nav -->
{% for section in site.nav_tips %}
<div class="nav-docs-section">
<h3>{{ section.title }}</h3>
<ul>
{% for item in section.items %}
<li>
<a href="/react/cookbook/{{ item.id }}.html"{% if page.id == item.id %} class="active"{% endif %}>{{ item.title }}</a>
<a href="/react/tips/{{ item.id }}.html"{% if page.id == item.id %} class="active"{% endif %}>{{ item.title }}</a>
</li>
{% endfor %}
</ul>

6
_layouts/cookbook.html → _layouts/tips.html

@ -1,6 +1,6 @@
---
layout: default
sectionid: cookbook
sectionid: tips
---
<section class="content wrap documentationContent">
@ -13,10 +13,10 @@ sectionid: cookbook
<div class="docs-prevnext">
{% if page.prev %}
<a class="docs-prev" href="/react/cookbook/{{ page.prev }}">&larr; Prev</a>
<a class="docs-prev" href="/react/tips/{{ page.prev }}">&larr; Prev</a>
{% endif %}
{% if page.next %}
<a class="docs-next" href="/react/cookbook/{{ page.next }}">Next &rarr;</a>
<a class="docs-next" href="/react/tips/{{ page.next }}">Next &rarr;</a>
{% endif %}
</div>

8
cookbook/01-introduction.md → tips/01-introduction.md

@ -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)

2
cookbook/02-inline-styles.md → tips/02-inline-styles.md

@ -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

2
cookbook/03-if-else-in-JSX.md → tips/03-if-else-in-JSX.md

@ -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

2
cookbook/04-self-closing-tag.md → tips/04-self-closing-tag.md

@ -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

2
cookbook/05-maximum-number-of-jsx-root-nodes.md → tips/05-maximum-number-of-jsx-root-nodes.md

@ -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

6
cookbook/06-style-props-value-px.md → tips/06-style-props-value-px.md

@ -1,7 +1,7 @@
---
id: style-prop-value-px
id: style-props-value-px
title: Shorthand for Specifying Pixel Values in style props
layout: cookbook
layout: tips
permalink: style-props-value-px.html
prev: maximum-number-of-jsx-root-nodes.html
next: children-props-type.html
@ -16,7 +16,7 @@ var divStyle = {height: 10}; // rendered as "height:10px"
React.renderComponent(<div style={divStyle}>Hello World!</div>, mountNode);
```
See [Inline Styles](/react/docs/cookbook/inline-styles-tip.html) for more info.
See [Inline Styles](/react/docs/tips/inline-styles-tip.html) for more info.
Sometimes you _do_ want to keep the CSS properties unitless. Here's a list of properties that won't get the automatic "px" suffix:

2
cookbook/07-children-props-type.md → tips/07-children-props-type.md

@ -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

4
cookbook/08-controlled-input-null-value.md → tips/08-controlled-input-null-value.md

@ -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`.

4
cookbook/09-componentWillReceiveProps-not-triggered-after-mounting.md → tips/09-componentWillReceiveProps-not-triggered-after-mounting.md

@ -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.

2
cookbook/10-props-in-getInitialState-as-anti-pattern.md → tips/10-props-in-getInitialState-as-anti-pattern.md

@ -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

4
cookbook/11-dom-event-listeners.md → tips/11-dom-event-listeners.md

@ -1,7 +1,7 @@
---
id: dom-event-listeners
title: DOM Event Listeners in a Component
layout: cookbook
layout: tips
permalink: dom-event-listeners.html
prev: props-in-getInitialState-as-anti-pattern.html
next: initial-ajax.html
@ -9,7 +9,7 @@ next: initial-ajax.html
> Note:
>
> This entry shows how to attach DOM events not provided by React ([check here for more info](/react/docs/cookbook/events.html)). This is good for integrations with other libraries such as jQuery.
> This entry shows how to attach DOM events not provided by React ([check here for more info](/react/docs/tips/events.html)). This is good for integrations with other libraries such as jQuery.
Try to resize the window:

2
cookbook/12-initial-ajax.md → tips/12-initial-ajax.md

@ -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

4
cookbook/13-false-in-jsx.md → tips/13-false-in-jsx.md

@ -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…
Cancel
Save