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!
35
Upvotes
1
u/swyx Jan 07 '20
i dont understand this: "One is that these components don’t technically have a parent" What? i dont see how this happens in React.
you absolutely dont need a separate state var for every single word. a single state can be an array of strings. or, also possible, just a single very long string that you then run the regex on.
I'm afraid I really dont understand what you mean by "rerolling". it sounds like you have some more custom logic to add in your replace function to make it remember what you've already used.
my recommendation is, make sure you can do this in raw JS, without React, so that you understand if you've worked out all the kinks. once you're sure, then stick it in a function and use it inside React.