Starting with the tutorial straight from Facebook: https://facebook.github.io/react/docs/tutorial.html
- successfully installed with
git clone https://github.com/reactjs/react-tutorial.git
- required
npm install
- successfully started server running
node server.js
- viewing atlocalhost:3000
- my first Ah-ha is that React can essentially be used to consume a custom API and render components via React components. They are not DOM nodes, apparently - React components are their own thing.
react-dom
(ReactDOM
) gives you DOM-specific methods, whilereact
(react native) gives you React methods.- nesting components is super awesome, and now starting to click how to pass data down the pipe with
this.props
- linking a JSON data source to the components now. Apparently
props
are immutable, meaning that if we change one it won't change down the pipe. This means we usethis.state
, which can be updated by runningthis.setState()
and passing in parameters based off the component's needs. - cool functionality of passing actual functions down the Component chain via properties in the component (i.e.
<Component functionName="this.functionDefinition" />
) - you can access this in theChildComponent
viathis.props.functionName
- GOTCHA: the FB tutorial uses
babel
for running the JSX compiler, which means your<script>
tags must usetype="text/babel"
instead oftext="type/javascript"