Did you like how we did? Rate your experience!

Rated 4.5 out of 5 stars by our customers 561

Video instructions and help with filling out and completing Why 8850 Form Submission

Instructions and Help about Why 8850 Form Submission

So before we get started on this one I want to make sure that you have everything up-to-date now I just released a video where I show you how to get all of your dependencies up to the latest versions because some of the techniques we're going to be doing in this video require you to have the latest versions of this stuff not to mention you want to sort of be on the latest anyways if it's a long-term release candidate so now we have version 15 of react react on version 15 and all this good stuff with our web pack and Babel loaders so if you want to find out exactly how we updated everything check out the video there's a link to it in the description and there's a annotation on the screen right now that you can click watch that video first before continuing on with this series if your react dependencies do not look like this okay so this is going to be a little bit interesting what we're going to be doing is essentially adding people to our list here if we come to our site you could see we had that searching going we're working great right but we want to be able to add people no this is sort of different because what we don't have is we don't have a database we're working with so this is going to be a look less about how you actually add things in a little bit more about a 4-man done submit and stuff like that so in this video we're going to head to our contacts list at Jas and the first thing I want to do is set our entire list of people our entire contacts which we had as this step props contacts we want to have that in a state variable like I said this isn't necessarily how you might be doing things in the future if you're working with a database I know meteor and react is a really popular stack and obviously you wouldn't need to be putting your data into a state variable but for right now let's just go ahead and not worry too much about that and we can just say simply contexts is going to be equal to and now we need to bring in props I don't know if we've done this yet but we need to bring in our props into our constructor so we can save props and then we also need to bring in our props into the super now instead of being able to say this dot props we can just simply say props if you try to use props when setting state inside of your constructor and if you don't pass in props into constructor and super it will not work so go ahead and do that now we just need props dot contacts okay we can verify this totally worked by using this dot state contacts when we have our filtered contacts so we can say this dot state that context because it's going to look at this which is set to our props and that should totally work now because uh this is essentially the only place we were actually looking at that contacts list let's go ahead our application give this a refresh and you can see our names are still coming in and the filtering is still working cool so let's go ahead and now what we want to do is add a form we have this input here before and that's all all fine let's go ahead and add a placeholder to this place holder and that can just be equal to search just so we have a differentiator between the two text box considering we don't have really any style going on here at all now below this one I'm going to go ahead and add a form okay nothing crazy here and inside of this form we need a couple of boxes we need two text boxes one of which is going to be for the name and the other one is going to be for the phone number we can say input type is equal to text and this is going to have a ref of name now I'm going to show you how we can use refs to grab the value directly from this input without actually having to set it into state now it was useful for this search box input to be in state right because every single time we were updating it we were using that value and this time we're essentially going to be grabbing the values whenever we submit this form so it's not as useful for these to be controlled inputs now we can have this be phone okay now of course you could have a placeholder and everything like that but this isn't an exercise in building a sort of user friendly website here this is just sort of a react concept stuff so what we want to do is we have our input type text in our input type text that's a phone we have both of our hand puts now let's go ahead and actually respond to the event before we had an unchanged on the input let's go ahead and have an on submit which is an event that we have for forms now this can take a function which we can have is this that and we can add contact okay and we'll also need to dot find this because we're going to be wanting to use this okay super cool so now we need to add this add contact function because what this is going to do is essentially we're going to grab both of these values then we're just going to put them into the state so we can come up here and we can have an add contact function and we need the.

If you believe that this page should be taken down, please follow our DMCA take down process here.