I’ve been working through the web dev path and quite happy with my progress since I’d never done any coding before last November, but I’m really struggling with React. I’ve almost completed the module but have tried to do a personal project and realised I have no idea what I’m doing.
I need someone to explain props, state and passing things between components in the simplest terms possible. Kind of on the ‘trying to explain to your grandparents how to use FaceTime’ level…
I found the entire module to be a case of ‘write this bit of code then move on to the next step’ and most of the time it wasn’t clear what I was trying to achieve or how the snippet of code I was writing would help me reach that goal. With the earlier HTML/CSS/JS lessons I managed to get a good grasp of it very easily but the React one seems to have a lot of holes in it.
Case in point 1: I’ve finished the Ravenous app but it’s not rendering properly. I have absolutely no idea why because I don’t know what any of the code I’ve written actually does, how the components all connect up, what each one is doing, anything like that.
Case in point 2: For a personal project I thought I’d build a simple travel website, where a user can type in a city and it then returns things like a weather forecast, popular tourist attractions, whatever other cool stuff I can find from APIs. I feel confident doing this in more simple HTML/CSS/Java coding but when I started trying to build it in React I realised I didn’t even know where to start.
I’d like to create a ‘Searchbar’ component which renders a search field then returns whatever the user inputs as a global variable ‘city’ to the top-level App.js file for use in other components. I realised I have no idea how to do this. Can build the constructor method, build the event handler, build the render function, but just getting it all to connect up seems totally beyond me.
TLDR - can someone explain props, state and passing info between components in language a total moron could understand…
Thanks in advance!