Thanks for all the great videos, they've helped me a lot, and still do, whenever I'm trying to learn anything coding related! Any plans in the future for Redux?
Bro if you were lazy , you certainly use (ALT + SHIFT + (up/down) Arrow key to copy the line you are in ( without selecting and copy and paste) and if you select a bunch of lines it will copy ( up or down another one
Hello bro, i've been struggling with this stuff for a while now, can you make a video or explain here how can i edit and update the properties of an object that is inside of an useState array, thank you so much man, hope this comment reaches to you..
Hi BroCode can you explain me the logic for how the element got removed function handleRemoveCar(index){ setCars(c => c.filter((_, i) => i !== index)); } I did not understand ( i !== index) part ??
You need to focus on filter method. It returns an array of all the elements that meet the condition. And here it returns all other elements except the one whose index equals the 'given' index. That means we do not remove anything. But create a new array ignoring the one whose index equals the given index which is passed as the parameter of the function.
import React, { useState } from 'react';
function MyComponent() {
const [cars, setCars] = useState([]);
const [carYear, setCarYear] = useState(new Date().getFullYear());
const [carMake, setCarMake] = useState("");
const [carModel, setCarModel] = useState("");
function handleAddCar(){
const newCar = {year: carYear,
make: carMake,
model: carModel};
setCars(c => [...c, newCar]);
setCarYear(new Date().getFullYear());
setCarMake("");
setCarModel("");
}
function handleRemoveCar(index){
setCars(c => c.filter((_, i) => i !== index));
}
function handleYearChange(event){
setCarYear(event.target.value);
}
function handleMakeChange(event){
setCarMake(event.target.value);
}
function handleModelChange(event){
setCarModel(event.target.value);
}
return (
List of Car Objects
{cars.map((car, index) =>
handleRemoveCar(index)}>
{car.year} {car.make} {car.model}
)}
Add Car
);
}
export default MyComponent;
please explain lifecycle methode plz
Teacher, Could you teach . Net Programming C# windows form App?
1:39 1:41 1:41 1:42 1:43 1:43 1:43 1:43 1:44 1:44 1:44 1:44 1:44
Thanks for all the great videos, they've helped me a lot, and still do, whenever I'm trying to learn anything coding related!
Any plans in the future for Redux?
Bro if you were lazy , you certainly use (ALT + SHIFT + (up/down) Arrow key to copy the line you are in ( without selecting and copy and paste) and if you select a bunch of lines it will copy ( up or down another one
But should we sit back and relax
Please make Reactjs projects as well
Noice video
Thank you very much bro
Hi Bro, could you please make a video on "why react?" I still have no clue why people use react.
Hello bro, i've been struggling with this stuff for a while now,
can you make a video or explain here how can i edit and update the properties of an object that is inside of an useState array, thank you so much man, hope this comment reaches to you..
Cool
npm run dev -- --host 0.0.0.0 --port 5173 is not working in the mobile do you have idea? Connected into same Router.
my carYear variable returned 2024 What do I do?
Hi BroCode
can you explain me the logic for how the element got removed
function handleRemoveCar(index){
setCars(c => c.filter((_, i) => i !== index));
}
I did not understand ( i !== index) part ??
You need to focus on filter method. It returns an array of all the elements that meet the condition. And here it returns all other elements except the one whose index equals the 'given' index.
That means we do not remove anything. But create a new array ignoring the one whose index equals the given index which is passed as the parameter of the function.
dearest bro, would you start a discord bro code community? I can set it up if you dont have the time
Bro how many coding languages you know
Wassup
Code bro what are u doing
Who's watching this in 2024 too 👇
its not even 2024 yet
is me
Hey bro, could you please make a Visual Studio Code 22 full course tutorial?