Browse Source

small typo and code tag is now js highlight

Was html before bc github screws up the js highlighting for jsx.
main
Cheng Lou 11 years ago
committed by Connor McSheffrey
parent
commit
24533462ff
  1. 4
      cookbook/cb-02-inline-styles tip.md
  2. 4
      cookbook/cb-02-inline-styles.md
  3. 4
      cookbook/cb-03-if-else-in-JSX tip.md
  4. 4
      cookbook/cb-03-if-else-in-JSX.md

4
cookbook/cb-02-inline-styles tip.md

@ -6,9 +6,9 @@ permalink: inline-styles.html
script: "cookbook/inline-styles.js"
---
In React, inline styles are nto specified as a string, but as an object whose key is the camelCased version of the style name, and whose value is the style's value in string:
In React, inline styles are not specified as a string, but as an object whose key is the camelCased version of the style name, and whose value is the style's value in string:
```html
```js
/** @jsx React.DOM */
var divStyle = {

4
cookbook/cb-02-inline-styles.md

@ -7,12 +7,12 @@ script: "cookbook/inline-styles.js"
---
### Problem
You want to put inline style to an element.
You want to apply inline style to an element.
### Solution
Instead of writing a string, create an object whose key is the camelCased version of the style name, and whose value is the style's value, in string:
```html
```js
/** @jsx React.DOM */
var divStyle = {

4
cookbook/cb-03-if-else-in-JSX tip.md

@ -8,7 +8,7 @@ script: "cookbook/inline-styles.js"
`if-else` statements don't work inside JSX, since JSX is really just sugar for functions:
```html
```js
/** @jsx React.DOM */
// this
@ -21,7 +21,7 @@ Which means `<div id={if (true){ 'msg' }}>Hello World!</div>` doesn't make sense
What you're searching for is ternary expression:
```html
```js
/** @jsx React.DOM */
// this

4
cookbook/cb-03-if-else-in-JSX.md

@ -12,7 +12,7 @@ You want to use conditional in JSX.
### Solution
Don't forget that JSX is really just sugar for functions:
```html
```js
/** @jsx React.DOM */
// this
@ -25,7 +25,7 @@ Which means `<div id={if (true){ 'msg' }}>Hello World!</div>` doesn't make sense
What you're searching for is ternary expression:
```html
```js
/** @jsx React.DOM */
// this

Loading…
Cancel
Save