In React, elements are building blocks of components. The simplest way to define a React component is to define a function:
function Greeter(props) { return <h3>Hello, {props.name}!</h3>; }
However, you can also use ECMAScript 6 class to define a component:
class Greeter extends React.Component { render () {
return <h3>Hello, {this.props.name}!</h3>;
} }
In React, React elements can represent DOM elements or React components:
const helloElement = <Greeter name="{user.name}"/>;
Also, real React apps are in fact composed of reusable components and elements, which are then rendered in a specific DOM element. This component model is very powerful and has some similarity to the notion of nested custom controls in ASP.NET, but is entirely implemented on the client side:
class Hello extends React.Component { render () {
return <h3>Hello, {this.props.name}!</h3>;
} } class HelloMakers...