r/reactjs • u/acemarke • Mar 02 '18
Beginner's Thread / Easy Questions (March 2018)
Last month's thread was pretty busy - almost 200 comments . If you didn't get a response there, please ask again here!
Soo... 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.
The Reactiflux chat channels on Discord are another great place to ask for help as well.
27
Upvotes
View all comments
Show parent comment
1
u/gyfchong Mar 25 '18
I can't say why the <div> doesn't show the function, but I suspect it's something to do with having executed the function ie. using the brackets () always executes it, even when passed as a prop.
Working code: https://codesandbox.io/s/rl53r0vk04
As with the previous comment, you still need to pass it a function that returns a function that has the index passed through.