Atsushi Yamamoto
@jumbosushi
https://facebook.github.io/react/
"To address issues with disconnection, incorrect message counts, and
missed and duplicated messages, we recently undertook an effort
we called the "mercury project.""
class Hello extends React.Component {
render() {
return <div>Hello World!</div>;
}
};
ReactDOM.render(
<Hello />,
document.getElementById('root')
);
Ex. class -> className
class Hello extends React.Component {
render() {
return React.createElement('div', null, `Hello World`);
}
};
ReactDOM.render(
React.createElement(Hello, null, null),
document.getElementById('root')
);
class Hello extends React.Component {
render() {
return React.createElement('div', null, `Hello World`);
}
};
ReactDOM.render(
React.createElement(Hello, null, null),
document.getElementById('root')
);
A ReactElement is a light, stateless, immutable, virtual representation of a DOM Element.
(https://facebook.github.io/react/docs/react-api.html)
- Stateful
- Can be used by <Component> JSX syntax
- Can be nested
class Hello extends React.Component {
render() {
return <div>Hello {this.props.who}</div>;
}
};
class App extends React.Component {
render() {
return(
<Hello who="World"/>
)
}
};
ReactDOM.render(
<App />,
document.getElementById('root')
);
class Hello extends React.Component {
constructor() {
super()
this.state = {
who: "World"
}
}
render() {
return <div>Hello {this.state.who}</div>;
}
};
class App extends React.Component {
render() {
return(
<Hello />
)
}
};
ReactDOM.render(
<App />,
document.getElementById('root')
);
API
Scott Domes
https://engineering.musefind.com/react-lifecycle-methods-how-and-when-to-use-them-2111a1b692b1
- Maintained by component
- Can change it
- Should be considered private
- Maintained by parent
- Passed in from parent
- Can't change it
State
Props
render()
render()
A
B
B
A
class Hello extends React.Component {
render() {
return <div>Hello World!</div>;
}
};
ReactDOM.render(
<Hello />,
document.getElementById('root')
);
React Native Demo
https://facebook.github.io/react-native/docs/using-a-scrollview.html
React VR Demo
- Learning curve
- Over engineering
- Frequent Update
- BSD License
- Made for Facebook
https://github.com/facebook/react/wiki/sites-using-react
@jumbosushi