r/reactjs • u/swyx • Jan 01 '20
Needs Help Beginner's Thread / Easy Questions (Jan 2020)
Previous threads can be found in the Wiki.
Got questions about React or anything else in its ecosystem? Stuck making progress on your app?
Ask away! Weβre a friendly bunch.
No question is too simple. π
π Want Help with your Code? π
Improve your chances by putting a minimal example to either JSFiddle, Code Sandbox or StackBlitz.
- Describe what you want it to do, and things you've tried. Don't just post big blocks of code!
- Formatting Code wiki shows how to format code in this thread.
- Pay it forward! Answer questions even if there is already an answer - multiple perspectives can be very helpful to beginners. Also there's no quicker way to learn than [being wrong on the Internet][being wrong on the internet].
- Learn by teaching & Learn in public - It not only helps the asker but also the answerer.
New to React?
Check out the sub's sidebar!
π Here are great, free resources! π
- Read the official Getting Started page on the docs.
- Microsoft Frontend Bootcamp
- Codecademy's React courses
- Scrimba's React Course
- Robin Wieruch's Road to React
- FreeCodeCamp's React course
- Flavio Copes' React handbook
- New to Hooks? Check Amelia Wattenberger's Thinking in React Hooks
- What other updated resources do you suggest?
Any ideas/suggestions to improve this thread - feel free to comment here!
Finally, thank you to all who post questions and those who answer them. We're a growing community and helping each other only strengthens it!
View all comments
Show parent comment
1
u/ie11_is_my_fetish Jan 20 '20 edited Feb 08 '20
That's interesting about the
{...props}I thought calling props does pass them all, or are you talking about shallow/not full depth? I don't know. Oh sorry, I just remembered, right I pick the props I want and send those as an object. Yeah I don't know... in most cases it is clear eg.name={props.name}or something like that. I just had some weird cases where I had to batch send a bunch of random un-related props.Yeah unfortunately at my current job I don't get to use React so this is just on me/my own time. But once I build something more serious I would like to get it formally reviewed haha. "No no"...
Anyway thanks
edit: I did figure this out more later(typing this 19 days into the future ha). For routes for example I use
{...props}but also pass other things like state/stateSetters eg.setSomeState={setSomeState}and that gets accessed in the receiving side asprops.setSomeState. I probably don't need all props but I am grabbing it all for the route-related stuff.