Skip to content

Commit

Permalink
small edits
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Mar 23, 2020
1 parent 8d2d7d1 commit 63bf0dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/exercise/03.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
// 💰 there are a few subtle differences between JSX and HTML. One such
// difference is how you apply a class to an element in JSX is by using
// `className` rather than `class`!
// 📜 You can learn the differences between JSX and HTML syntax from the React docs here:
// https://reactjs.org/docs/dom-elements.html#differences-in-attributes

ReactDOM.render(element, document.getElementById('root'))
</script>
Expand Down
9 changes: 7 additions & 2 deletions src/exercise/03.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ application to the browser, but because Babel is written in JavaScript we can
actually run it _in_ the browser to compile our code on the fly and that's what
we'll do in this exercise.

So we'll include a script tag for Babel, then we'll update our own script tag to
tell Babel to compile it for us on the fly. When you're done, you should notice
the compiled version of the code appears in the `<head>` of the DOM (which you
can inspect using DevTools).

## Extra Credit

### 💯 interpolate className and children
Expand All @@ -47,7 +52,7 @@ const message = `${greeting} ${subject}`
```

See if you can figure out how to extract the `className` (`"container"`) and
`children` (`Hello World`) to variables and interpolate them in the JSX.
`children` (`"Hello World"`) to variables and interpolate them in the JSX.

```jsx
const className = 'container'
Expand Down Expand Up @@ -86,7 +91,7 @@ Or, it could be written like this:
const element = React.createElement('div', {...props})
```
See if you can figure out how to make that work now.
See if you can figure out how to make that work with JSX.
📜 https://reactjs.org/docs/jsx-in-depth.html#spread-attributes
Expand Down

0 comments on commit 63bf0dd

Please sign in to comment.