I would very much like to see the select implementation with checkbox and chips component in the advance section later in this series... Hope you'll make one...
Hello, Your tutorials are excellent. I follow the same steps shown in the video, but in the console, logs country is printing twice. What is the reason behind this?
This is because of react strict mode and this happens only in dev builds not in production builds. This happens to scan over code and show the possible warning if it exists.
I didn't understand why below code was used? setCountries(typeof value === "string" ? value.split(",") : value); why not just this? setCountries(value);
Been a while so I'm assuming you figured this out. But for anyone else reading this: if you're following along with JS instead of TS like I am, "setCountries(value)" is perfectly fine. However, variables have set types in TS, and like the other guy said, "value" can be a string in some cases. You can't assign "value" (a string) to "countries" (an array) if you're using TS, so you need to use "split()" to convert the value into an array first.
HI there , i want to a know how to set dynamic value in select button using map and fetch that data which is selected using event how could i can do this could you explain
setCountries(typeof value === "string" ? value.split(",") : value); Why giving value in else condition? setCountries(typeof value === "string" && value.split(",")); Why we can't use this?
I think it is a good practice to use ternary operator over && operator if we want to use short hand of if-else, but if we want to check both the conditions to be true like if (value && array.length && !error) { * do something * } here we must use && operator. And there is one issue with && operator that if you want to do something if array.length is true and you use array.length && *your code* it work totally fine but if array.length is false it will display '0' (zero) on the UI which you have to handle further. So to avoid such scenarios try using && operator only for conditions and ternary to handle truly and falsy values.
Can someone tell me how the line executes? typeof value === "string" ? value.split(",") : value I didn't understand the execution. If I select option India, I get object as 0:"IN". Now it compares typeof value === string which is false. Now it assigns the second option value into countries. but how the value appends to the string array here? As far as I know to add new element into an array arr, we do setArr([...arr, value]); Why aren't we doing the same over here? What is the use of split(",") here?
the value of e.target.value is array not object, by doing value === 'string' ?value.split(','):value , we are checking if the value is string or not if it is a string than using value.split(',') we split the that string into array than it will be assign to countries but if its array by default then we just directly assign the value to countries
Appreciated the usage of typescript :)
Amazing job love your work. Why did you choose to go with TexField over Select component?
good question
Nice, but what about on update a record
How to set dynamic value fetch from database for select using setValue react hook form and mui
do you know how to excute the question you asked i am confused to use the dynamic values if you have kindly share the repo thanks
great tutorial. could you please upload the codes and let us to download it and have all components?
How can we have drop down only
for display
Many thanks. Great explanation.
How will I work with onFocus event in select input? İt is not working with select input while working with others type of input.
Amazing job!
How to make dropdown list sticky when i scroll up and down, it moves ?
if i need treeselect, how to custom it,thanks
I would very much like to see the select implementation with checkbox and chips component in the advance section later in this series... Hope you'll make one...
yes i prefer checkbox too. i think the same thing
Hello, Your tutorials are excellent.
I follow the same steps shown in the video, but in the console, logs country is printing twice.
What is the reason behind this?
If Im not mistaken it has something to do with react.strictmode.
This is because of react strict mode and this happens only in dev builds not in production builds.
This happens to scan over code and show the possible warning if it exists.
What is the theme of your VS Code? 😀
how if select using optgroup?
How to implement this in a react class component?
how to add search filter ???
Muito bom, Parabéns pelos seus vídeos.
where is the source code of this course?
is there a way to make cascading select fields?
I didn't understand why below code was used?
setCountries(typeof value === "string" ? value.split(",") : value);
why not just this?
setCountries(value);
Because user can choose one country and that will be string and could send more then one country and that will be array
Been a while so I'm assuming you figured this out. But for anyone else reading this: if you're following along with JS instead of TS like I am, "setCountries(value)" is perfectly fine. However, variables have set types in TS, and like the other guy said, "value" can be a string in some cases. You can't assign "value" (a string) to "countries" (an array) if you're using TS, so you need to use "split()" to convert the value into an array first.
HI there , i want to a know how to set dynamic value in select button using map and fetch that data which is selected using event how could i can do this could you explain
What is the difference between the Select component and the TextField field component used like this?
idk correct way is to use select component, textfield component does not even works for me
Seems like TextField can give you more ability to customize the design and functionality of a dropdown
Well done
setCountries(typeof value === "string" ? value.split(",") : value);
Why giving value in else condition?
setCountries(typeof value === "string" && value.split(","));
Why we can't use this?
I think it is a good practice to use ternary operator over && operator if we want to use short hand of if-else, but if we want to check both the conditions to be true like
if (value && array.length && !error) {
* do something *
}
here we must use && operator. And there is one issue with && operator that if you want to do something if array.length is true and you use array.length && *your code* it work totally fine but if array.length is false it will display '0' (zero) on the UI which you have to handle further. So to avoid such scenarios try using && operator only for conditions and ternary to handle truly and falsy values.
U are a god
Could u make video about react-redux with multiple langauge
your first option was india.. thanks
NICE
Can someone tell me how the line executes?
typeof value === "string" ? value.split(",") : value
I didn't understand the execution. If I select option India, I get object as 0:"IN". Now it compares typeof value === string which is false. Now it assigns the second option value into countries. but how the value appends to the string array here? As far as I know to add new element into an array arr, we do setArr([...arr, value]); Why aren't we doing the same over here? What is the use of split(",") here?
same issue with me.
the value of e.target.value is array not object, by doing value === 'string' ?value.split(','):value , we are checking if the value is string or not if it is a string than using value.split(',') we split the that string into array than it will be assign to countries but if its array by default then we just directly assign the value to countries
Pls show good way for styling app, styled looks like a mess for me( Event makeStyles looks better
Great
Looking for Chips :D :P
as long as typescript is not necessity to learn mui, it is better to use react in tutorial.
but nice tutorial
but why?
Please upload android tutorial using kotlin 🥺