Create Dynamic Form Fields in React

preview_player
Показать описание
By creating dynamic form this will help if you don't know how much input fields user want, and we are going to use Material-UI just for make it little bit loot nicer.

Support The Channel:

🌎 Find Me Here:

––––––––––––––––––––––––––––––
Creative Commons — Attribution 3.0 Unported — CC BY 3.0
––––––––––––––––––––––––––––––

#dynamicForm #React #enjoyCoding
Рекомендации по теме
Комментарии
Автор

With splice() function in your handleAddFields() handler you will be able to add new fields in beetween existing fields, not only at the bottom like you've done it. Try this:

handleAddFields(index)
{
const fields = [...this.state.inputFields];
fields.splice(index+1, 0, { firstName: "", lastName: "" });
this.setState({
inputFields: fields
});
}

The difference is I work with class-based component here. Also note that you have to pass index into the event handler.

By the way - excellent tutorial, helped me a lot :)

xxfce
Автор

awesome job CanDev I have been looking for an example of this for a while!!!

khandoor
Автор

Precise, Excellent and very useful video for beginners. Good work.

Bluesmile
Автор

That's a great tutorial! Helped me lots with my current project <3

yemmeth
Автор

Very Very useful ! I struggled lot and got landed here, Thank you!!

ajaybedre
Автор

This is exactly what I was looking for. Thank you so much.

mewsnetics
Автор

Great tutorial, helped me a lot with my current project.

nijarshrestha
Автор

Broh, this was dope, you the greatest !

mikealejandro
Автор

Very slick piece of coding and saved me a ton of time. Thank you!

MrJacques
Автор

This is a great tutorial! Well explained.

malshamadushani
Автор

Best video for dynamic form really awesome, Thank you so much for this video

durgeshjhalwa
Автор

I just see the code and it works, You have a new suscriber

joaquinpettinari
Автор

Very awesome. I think I'd prefer it without the styling but I love it. Great job.

Human_Evolution-
Автор

Thank you so much for helping me out. I was finding the solution for 2 days❤

rohittewari
Автор

Thank you so much... It helps me a lots! 😀

maingocdieptran
Автор

This is a pretty easy to follow tutorial

giantqtipz
Автор

Thank you so much..This is a very useful project.

DidYouKnowThis.
Автор

you are a lifesaver, I cant thank you enough.

gourabpaul
Автор

I appreciate you bro , you saved my time.

tuna
Автор

I was stuck on this sort of problem (but I wanted to render a dynamic number of fields based on user input) for hours. I could get the forms to render but I could not figure out how to watch a dynamic number of inputs in state AND having a way to access their unique values.

I tried to do what I wanted with your pattern, and I could probably figure it out eventually but this worked and is great in its on way. Thank you

sweetshoez