I'm try create two component of ReactJS in the same file JS.
I have two component called "Welcome" and Goodbye"
class Welcome extends React.Component {
render() {
return <h1>Hello {this.props.message}!</h1>;
}
}
class GoogBye extends React.Component {
render() {
return <h1>GooyBye {this.props.message}!</h1>;
}
}
Okay here I try create two compoents and next I try call from the ReactDOM.render of this way:
ReactDOM.render(
<Welcome message="my friend" />,
<GoodBye message="see you later" />,
document.getElementById("root")
);
I am trying create two components and next I call the two
full code:
<html>
<head>
<script src="https://unpkg.com/react@15/dist/react.min.js"> </script><script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js">
</script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
class Welcome extends React.Component {
render() {
return <h1>Hello {this.props.message}!</h1>;
}
}
class GoogBye extends React.Component {
render() {
return <h1>GooyBye {this.props.message}!</h1>;
}
}
ReactDOM.render(
<Welcome message="my friend" />,
<GoodBye message="see you later" />,
document.getElementById("root")
);
</script>
</body>
</html>
I am looked for a solve in stackoverflow before of I create this question and I saw this only but is not the solve for my problem: this
I am start witn React JS with this tutorial