This document provides an introduction and overview of ReactJS concepts including components, JSX, props, state, lifecycle methods and the virtual DOM. It compares ReactJS to AngularJS, noting ReactJS uses a non-MVC architecture and focuses on just the view layer while AngularJS follows MVC. Later sections discuss additional ReactJS topics like Flux, Redux, Webpack and RamdaJS.
19. Part 2: Key Points
You can write classes in JS (as in Java)
As with JSX it is just a syntactic sugar
At compile time Babel translates it to plain old JS
Arrow functions is a shorthand for writing functions.
24. Part 3: Key Points
Writing a ReactJS component is as simple as writing a function.
Compare this with AngularJS directive.
In reality ReactJS components are functions.
38. Part 4: Key Points
React Components are just functions.
Props are external to the function.
State is internal to the function.
Calling setState({...}) re-renders the component.
The return type of the function is
JSX
43. Part 5: Key Points
React is made up on Components.
Components can be nested.
The component hierarchy is a tree.
Unlike Angular you can create small components.
Try to make your component stateless for more control.
60. Part 6: Key Points
React doesn’t have a separate template layer.
Doesn’t follow MVC paradigm.
The strength comes from JS itself.
That’s why react is just ‘V’ in MVC.
Except for View JS can do everything.
63. class AngularDemo extends React.Component {
render() {
var colors = ['red', 'blue', 'green'];
var list = colors.map((color)=><li>{color}</li>);
// even this is not react
return (
<ul>
{list}
</ul>
);
}
}