Тёмный

React JS how to update ARRAYS in state 🍎 

Bro Code
Подписаться 1,9 млн
Просмотров 9 тыс.
50% 1

#reactjs #tutorial #course
"You can put objects and arrays into state. In React, state is considered read-only, so you should replace it rather than mutate your existing objects. For example, if you have a form object in state, don’t mutate it:"

Опубликовано:

 

19 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@BroCodez
@BroCodez 5 месяцев назад
import React, { useState } from 'react'; function MyComponent() { const [foods, setFoods] = useState(["Apple", "Orange", "Banana"]); function handleAddFood(){ const newFood = document.getElementById("foodInput").value; document.getElementById("foodInput").value = ""; setFoods(f => [...f, newFood]); } function handleRemoveFood(index){ setFoods(foods.filter((_, i) => i !== index)); } return ( List of Food {foods.map((food, index) => handleRemoveFood(index)}> {food} )} Add Food ); } export default MyComponent;
@Tendity
@Tendity 5 месяцев назад
I just want to say you have saved me SO MUCH time with your coding vids so thank you man
@--bountyhunter--
@--bountyhunter-- 5 месяцев назад
ey man, u and js mastery are the two most underrated creators i've seen u two deserve waay more subscribers than this tnx for all your efforts man . love ya
@Gian_sas
@Gian_sas 5 месяцев назад
thanks for your vids man, they are truly helpful 🙏 love from Argentina❤
@sidm5105
@sidm5105 5 месяцев назад
Bro Code your my favorite youtuber. Keep up this good work.
@eharsha7389
@eharsha7389 5 месяцев назад
Good Explanation bro
@pennyklen4973
@pennyklen4973 27 дней назад
Bro, why use document.getElementById in React???
@maskedman0677
@maskedman0677 5 месяцев назад
Hey Bro code do you do a cybersecurity tutorial too ?
@karolkoprowski4539
@karolkoprowski4539 5 месяцев назад
Thanks for the video as always, bro
@bartuskoprowski7543
@bartuskoprowski7543 5 месяцев назад
Amazing video i learned alot about ARRAYS in state
@RED-so9mp
@RED-so9mp 4 месяца назад
for deleting the elements can we use updater functions as well? like setFoods((f) => f.filter((_, i) => i !== index));
@rishabhkedia9304
@rishabhkedia9304 3 месяца назад
Please make Reactjs projects as well
@OCEMTechZone
@OCEMTechZone 3 месяца назад
Great 🎉
@kuru6029
@kuru6029 5 месяцев назад
can you please create a video about how can your website send an email to someone?
@_amonimus_
@_amonimus_ 2 месяца назад
bro how many languages do you know
@ahmedtahagad
@ahmedtahagad 5 месяцев назад
Guys! You all Thank Bro like me for his effort to provide this awesome materials, so hasn’t the time come for us to thank our lord Allah who gives us an awesome brain to understand this masterpiece :) I really hope you all to wardship allah by the way he wants.
@urvish_xyz
@urvish_xyz Месяц назад
I found you accidentally ❤
@kamranalizade98
@kamranalizade98 5 месяцев назад
The Best Coding Channel ever Thank you Bro code✌🙏
@l213dhanesh3
@l213dhanesh3 5 месяцев назад
Code bro i love u
@raki0125
@raki0125 4 месяца назад
Now i am pro in react pls do redux i will share this vid as possible
Далее
React JS update ARRAY of OBJECTS in state 🚘
12:48
React useContext() hook introduction 🧗‍♂️
11:37
КТО ЭТО😱
00:41
Просмотров 1,3 млн
Build this React To-Do List app in 20 minutes! ☝
22:35
C 2D arrays ⬜
7:33
Просмотров 64 тыс.
Never Forget React forwardRef Again
9:33
Просмотров 11 тыс.
How to ADD/CHANGE HTML using JavaScript 🛠️
15:33
Build a Stopwatch using React in 20 minutes! ⏱
20:01
Why Signals Are Better Than React Hooks
16:30
Просмотров 445 тыс.