r/reactjs • u/swyx • Jul 01 '18
Help Beginner's Thread / Easy Question (July 2018)
Hello! just helping out /u/acemarke to post a beginner's thread for July! we had almost 550 Q's and A's in last month's thread! That's 100% month on month growth! we should raise venture capital! /s
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. You are guaranteed a response here!
New to React? Free, quality resources here
Read the new, official Getting Started page on the docs
/u/acemarke's suggested resources for learning React and his React/Redux links list.
Want Help on Code?
Improve your chances of getting helped by putting a minimal example on to either JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new). Describe what you want it to do, and things you've tried. Don't just post big blocks of code.
If you got helped, 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.
1
u/SelkiesTheEndless Jul 25 '18
Question about "pure" functions in JS and returning arrays/objects that are equal. This was a major aha moment for me when trying to debug a mapStateToProps function.
Same function called with the same inputs will return a different array. They will look equivalent to the human eye but that isn't really important when this difference causes a re-render.
Is there anyway to actually write the combine function that this would work? This is obviously a simplified version of my real issue
Is this where you could use reselect? The inputs would be the same so the function wouldn't actually return a new array but one that had been memoized.
Thanks in advance and I wanted to say thanks for all of the great questions and answers in this thread, they are really helpful!