官术网_书友最值得收藏!

  • React and React Native
  • Adam Boduch
  • 296字
  • 2021-07-09 19:28:49

Simplicity is good

React doesn't have many moving parts to learn about and understand. Internally, there's a lot going on, and we'll touch on these things here and there throughout the book. The advantage to having a small API to work with is that you can spend more time familiarizing yourself with it, experimenting with it, and so on. The opposite is true of large frameworks, where all your time is devoted to figuring out how everything works. The following diagram gives a rough idea of the APIs that we have to think about when programming with React:

React is pided into two major APIs. First, there's the React DOM. This is the API that's used to perform the actual rendering on a web page. Second, there's the React component API. These are the parts of the page that are actually rendered by React DOM. Within a React component, we have the following areas to think about:

  • Data: This is data that comes from somewhere (the component doesn't care where), and is rendered by the component
  • Lifecycle: These are methods that we implement that respond to changes in the lifecycle of the component. For example, the component is about to be rendered
  • Events: This is code that we write for responding to user interactions
  • JSX: This is the syntax of React components used to describe UI structures

Don't fixate on what these different areas of the React API represent just yet. The takeaway here is that React, by nature, is simple. Just look at how little there is to figure out! This means that we don't have to spend a ton of time going through API details here. Instead, once you pick up on the basics, we can spend more time on nuanced React usage patterns.

主站蜘蛛池模板: 德阳市| 安图县| 临猗县| 喜德县| 基隆市| 女性| 鹤岗市| 竹山县| 府谷县| 康乐县| 康乐县| 南川市| 中山市| 克东县| 博湖县| 抚宁县| 信阳市| 大余县| 黑龙江省| 侯马市| 金川县| 抚松县| 乌兰县| 文成县| 温泉县| 延吉市| 深水埗区| 尤溪县| 四川省| 军事| 谷城县| 永安市| 平邑县| 巫山县| 积石山| 福安市| 平原县| 垫江县| 全南县| 望奎县| 安化县|