Learn how you can pass data from one component to another through props in react js. Here we have declared two class components – Board and Square. We are passing data from Board class to the Square class.
Board.js
class Board extends React.Component {
renderSquare(i) {
return <Square value={i} />;
}
}
Square.js
class Square extends React.Component {
render() {
return (
<button className="square">
{this.props.value}
</button>
);
}
}
Source: ReactJs Docs