
JoJo
@loveboobs• Mar 16, 2023
实拍望京:韩国人撤了,互联网新贵和明星们来了,北京朝阳区最奢华的商务区之一(小叔TV EP243) - YouTube

3:30

3:36

3:47
实拍望京:韩国人撤了,互联网新贵和明星们来了,北京朝阳区最奢华的商务区之一(小叔TV EP243) - YouTubewww.youtube.com

JoJo
@loveboobs• Mar 9, 2023
Extracting State Logic into a Reducer • React
Components with many state updates spread across many event handlers can get overwhelming. For these cases, you can consolidate all the state update logic outside your component in a single function, called a reducer.
Each of its event handlers calls setTasks in order to update the state. As this component grows, so does the amount of state logic sprinkled throughout it.
To reduce this complexity and keep all your logic in one easy-to-access place, you can move that state logic into a single function outside your component, called a “reducer”. Reducers are a different way to handle state. You can migrate from useState to useReducer in three steps: Move from setting state to dispatching actions. Write a reducer function. Use the reducer from your component.
Extracting State Logic into a Reducer • Reactbeta.reactjs.org

JoJo
@loveboobs• Mar 7, 2023
Preserving and Resetting State
Notice how the moment you stop rendering the second counter, its state disappears completely. That’s because when React removes a component, it destroys its state.
Same component at the same position preserves state
pass it down to them via props. This is known as lifting state up, and it’s one of the most common things you will do writing React code.
Preserving and Resetting State • Reactbeta.reactjs.org

JoJo
@loveboobs• Mar 4, 2023
Passing Data Deeply with Context • React
Usually, you will pass information from a parent component to a child component via props. But passing props can become verbose and inconvenient if you have to pass them through many components in the middle, or if many components in your app need the same information. Context lets the parent component make some information available to any component in the tree below it—no matter how deep—without passing it explicitly through props.
This example uses heading levels because they show visually how nested components can override context. But context is useful for many other use cases too. You can use it to pass down any information needed by the entire subtree: the current color theme, the currently logged in user, and so on.
This tells React: “if any component inside this <Section> asks for LevelContext, give them this level.” The component will use the value of the nearest <LevelContext.Provider> in the UI tree above it.
Passing Data Deeply with Context • Reactbeta.reactjs.org

JoJo
@loveboobs• Feb 28, 2023
Reacting to Input with State
Step 1: Identify your component’s different visual states
Step 2: Determine what triggers those state changes
Step 3: Represent the state in memory with useState
Reacting to Input with State • Reactbeta.reactjs.org

JoJo
@loveboobs• Feb 25, 2023
JavaScript this
this is not unique to JavaScript. In other languages however, this always point sat instance of a class. On the other hand, in JavaScript, this is determined as execution context is created
JavaScript thisgo-kahlo-lee.ghost.io

JoJo
@loveboobs• Feb 25, 2023
Execution Context
As JavaScript engine starts executing main.js file from top to bottom, it first creates execution context for JavaScript file itself, namely for the entire program, which is called 'global execution context.' Then, every time a function is called, new environment context is created and put at the top of call stack.
Execution Contextgo-kahlo-lee.ghost.io

JoJo
@loveboobs• Feb 24, 2023
Sharing State Between Components
pass it down to them via props. This is known as lifting state up, and it’s one of the most common things you will do writing React code.
Notice how pressing one panel’s button does not affect the other panel—they are independent.
In contrast, you might say a component is “controlled” when the important information in it is driven by props rather than its own local state. This lets the parent component fully specify its behavior. The final Panel component with the isActive prop is controlled by the Accordion component.
Sharing State Between Components • Reactbeta.reactjs.org

JoJo
@loveboobs• Feb 23, 2023
Self-Driving Tesla vs Sunday Traffic to Supercharger | FSD Beta 10.69.25.2 - YouTube

6:00
Self-Driving Tesla vs Sunday Traffic to Supercharger | FSD Beta 10.69.25.2 - YouTubewww.youtube.com

JoJo
@loveboobs• Feb 22, 2023
Passing Props to a Component
Sometimes, passing props gets very repetitive:
Passing Props to a Component • Reactbeta.reactjs.org