实例
image.pnghttps://github.com/facebook/react
A declarative, efficient, and flexible JavaScript library for building user interfaces.
React is a JavaScript library for building user interfaces.
-
Declarative:
React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
-
Component-Based:
Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
-
Learn Once, Write Anywhere:
We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using
Learn how to use React in your own project.
传统的浏览器 DOM 操作与维护复杂性越来越高。
React 的出现正式为了解决 DOM 操作的问题。
React 的闪光点是在应用数据发生变化的时候。React 中有个 state 的概念。当 state 发生改变时,React 会自动 render 用户界面。这个时候,数据本身的变化成为我们真正需要关注的点。
JSX 语法
https://reactjs.org/docs/introducing-jsx.html
https://reactjs.org/docs/jsx-in-depth.html
网友评论