课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

State and event handlers

State and event handlers

- One simple way to understand the big picture of React is to think of the views react vendors in the browser as functions of data and state. You can think of the whole application as a big function of its data and state, but furthermore every React component is a function of some data and some state. Literally a React component is a JavaScript function that takes data as input through its props but it's also driven by an internal state that React manages for every component and it provides an API to work with that. The simplest method to manage a state element in a component is through the use state function. We can import this function from the React package. In any component, a call to this used state function makes React register a state variable for that component. What exactly is a state variable as known in React? Well, it's why React is named React. A state variable can be thought of as a reactive variable. We can…

内容