useState Hook in React JS || State: a component’s memory
Автор: The Mentors Tribe
Загружено: 2023-05-10
Просмотров: 154
Components often need to change what’s on the screen as a result of an interaction. Typing into the form should update the input field, clicking “next” on an image carousel should change which image is displayed, clicking “buy” puts a product in the shopping cart. Components need to “remember” things: the current input value, the current image, the shopping cart. In React, this kind of component-specific memory is called state.
You can add state to a component with a useState Hook. Hooks are special functions that let your components use React features (state is one of those features). The useState Hook lets you declare a state variable. It takes the initial state and returns a pair of values: the current state, and a state setter function that lets you update it.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: