Let’s check out how to send a fetch request using React Hooks.
Ok, to start we are going to assume you have a good idea of what React is and you have some bootstrap knowledge. Today I’m gonna walk you through rendering an HTML table with your react props and while using bootstrap to add a little flare. Also, I will assume you have access to some type of data, from an external API or a backend API.
For our JavaScript project, we had to use a backend API with rails. We had to somehow grab the data from the API with JavaScript. Luckily for us, our instructors showed us how to do just that. With Fetch API.
One of the tougher things to grasp in rails was nested routes. Nested routes and how to use those routes in with the actions. Also, how to use the parent and child relationships within forms and creating those new attributes. Crazy I know but trust me its a thing. So what im gonna do is show you a bit of what I struggled with in my rails project so maybe both you and I can understand it a bit better.
So far I have been understanding most subjects, for the most part. It seems as if I am getting the hang of most of them, and then the labs help for practice. I can’t help but get nervous a bit though when project week comes around. Not because I haven’t learned anything or I am not ready, but because putting it all together on your own is a bit overwhelming. You don’t know how much you’ve learned until you put your skills to the test with a project. I feel like out of all the lessons and labs, our projects are what allow us to learn key developmental skills.
I was feeling a bit overwhelmed when project week came, because I had not fully finished my labs, therefore meaning I was a bit behind, and the last couple labs I was working on really took me a long time to finish and I needed more help than usual. So as you can imagine, I didn’t feel the most confidence going into a project while behind on schedule, and seemingly feeling like I was in a rush. Luckily we get a nice 2 weeks to get it done. That has been a perfect amount of time for my situation.
It took me about 3-4 days just to come up with a project idea. My problem was, that instead of trying to think of a goal and then work my way to it. I was trying to think of the finish line. I was thinking, “how am I going to do this..”, “how is that model going to work..”, “How is this view going to connect with this..”, “I can’t have that as a controller..”. Then luckily I went back and watched one of our instructor’s videos in which he states, “don’t think of a project-based of the requirements, think of your project goal, vision and then create that vision”. That immediately made me change how I looked at it.
I realized I was overstressing myself and had to do little steps, one by one to get to the goal. The first step was to realize my vision. I wanted to create an app where you can sort of creating a list of your favorite games. I had thought of it before, but I couldn’t start any code because I was to caught up trying to meet the requirements in my head before I even started coding. Not Possible.
So then came step 2, building your foundation. I started building out my file tree, of course, you can’t start your project without any direction. I also had to be sure to install the correct gems to get me started. Can’t do much without your gems!