This chapter describes the production of a review column.
First, simply write a ract component to try it out.
Index.html
<!DOCTYPE HTML><HTML><Head> <title>Hello React</title> <Scriptsrc=".. /js/jquery.min.js "></Script> <Scriptsrc=".. /js/jsxtransformer.js "></Script> <Scriptsrc=".. /js/react-0.13.4.min.js "></Script> <Scriptsrc=".. /js/react-dom-0.14.0.js "></Script></Head><Body><DivID= "Content"></Div><Scriptsrc=".. /component/commentbox.js "type= "TEXT/JSX"></Script></Body></HTML>
Commentbox.js
var Commentbox = React.createclass ({ function() { return ( <div classname= "Commentbox" > Hello,world! I am a commentbox. (</div> ); }}); React.render ( <commentbox/>, document.getElementById (' content '));
The first thing to note here is because
1.commentbox.js gets the content that has been introduced in the index file Commentbox.js file to be placed behind the content.
2.reactdom.render () is also possible, but to introduce the corresponding react-dom.js file, followed by the version number after 13
3.comment.js file type= ' text/jsx ' If you have introduced a Babel file, you can also write Text/babel. Babel.js and Jsxtransformer.js are interchangeable, and the corresponding type is changed to JSX or Babel.
Reacto Small Project