首页 > 其他 > 详细

A Bite Of React(1)

时间:2017-11-16 00:45:55      阅读:333      评论:0      收藏:0      [点我收藏+]

react:

component and views : produce html abd add them on a page( in the dom)

<import React from ‘react‘> // core react library, know how to work with component. Create or manage a Dom
<import ReactDOM from ‘react-dom‘> //render component to dom

const App = function(){
    return <div>HI!</div>
}; // this is a component class, could produce a lot of instance.
  • ES6

const: ES6 syntax, declare a variable. And which means it won‘t change because it is constant
JSX:

  1. subset of javascript which looks like html but cannot be interpreted by browser.
  2. JSX could produce HTML
  3. JSX could be compiled into vanilla javascript( which means plain JS without any additional libraries)
ReactDOM.render(<App />, document.querySelector(‘.container‘)); //render component into dom
// transpire would translate JSX into javascript
// <App />is a simple instance of component App

 

const App1 = () => {
    return <div>Hi!</div>;
}
// => equals to keyword:this

 

A Bite Of React(1)

原文:http://www.cnblogs.com/ninalei/p/7841790.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!