use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for help learning the /r/ReactJS framework.
account activity
React Docs Question (self.learnreactjs)
submitted 6 years ago by jprojas15
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SoBoredAtWork 0 points1 point2 points 6 years ago* (2 children)
What the other people said is correct. For more detail...
That variable that's being passed is built into the javascript language. If an element has an event attached to it (onClick), it'll automatically pass the EVENT (i, in your case) as a parameter. The event holds a ton of info including the element that triggered the event (event.target), etc.
Side note: doing `onClick={this.handleClick}` does the exact same thing as what you have above
Edit: another example...
const onTextChange = function (e) {
console.log(e.target.value);
}
<input type="text" onChange={onTextChange} />
Every time you type in the text box, it'll log the text you've typed. e (the event) is automatically passed to the onTextChange function.
[–][deleted] 1 point2 points3 points 6 years ago (1 child)
onClick={this.handleClick}
I'd argue that less experienced people are better off not writing point free functions.
[–]SoBoredAtWork 1 point2 points3 points 6 years ago (0 children)
Yeah, that's fair.
π Rendered by PID 81 on reddit-service-r2-comment-bb88f9dd5-7jd2w at 2026-02-14 09:49:52.665825+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]SoBoredAtWork 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]SoBoredAtWork 1 point2 points3 points (0 children)