-
-
Save gaearon/faa67b76a6c47adbab04f739cba7ceda to your computer and use it in GitHub Desktop.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Add React in One Minute</title> | |
</head> | |
<body> | |
<h2>Add React in One Minute</h2> | |
<p>This page demonstrates using React with no build tooling.</p> | |
<p>React is loaded as a script tag.</p> | |
<p> | |
This is the first comment. | |
<!-- We will put our React component inside this div. --> | |
<div class="like_button_container" data-commentid="1"></div> | |
</p> | |
<p> | |
This is the second comment. | |
<!-- We will put our React component inside this div. --> | |
<div class="like_button_container" data-commentid="2"></div> | |
</p> | |
<p> | |
This is the third comment. | |
<!-- We will put our React component inside this div. --> | |
<div class="like_button_container" data-commentid="3"></div> | |
</p> | |
<!-- Load React. --> | |
<!-- Note: when deploying, replace "development.js" with "production.min.js". --> | |
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script> | |
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script> | |
<!-- Load our React component. --> | |
<script src="like_button.js"></script> | |
</body> | |
</html> |
amazing
Cool!
Amazing
Can we use functions instead of classes to load components?
帅的呀~
Thanks very much!
root.render(e(LikeButton));
this line i am not understand
root.render(e(LikeButton)); this line i am not understand
谢谢你
I had no idea it was possible to have as many root elements as you want. Could be considered as bad practice? Does it matter?
It seems to be great.
root.render(e(LikeButton));
this line i am not understand
Read the .js file that sets alias "e" to "React.createElement"
awesome
so niubility
in the return statement if add html tags I am getting syntax errors
can you please show an example with tags rendered with latest functions tags
root.render(e(LikeButton));
this line i am not understand
Same as root.render(React.createElement(LikeButton));
. Because of the earlier const e = React.createElement
.
hi,
thank you
It's very helpful to understand React advantage.
хорош