Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: describe how to pass props to event handlers #664

Open
sunilw opened this issue Mar 10, 2020 · 1 comment
Open

Suggestion: describe how to pass props to event handlers #664

sunilw opened this issue Mar 10, 2020 · 1 comment

Comments

@sunilw
Copy link

sunilw commented Mar 10, 2020

In the section on creating event handlers it may be very useful to describe how to work with a components properties from within the event handler.

This would make the exercises much easier.

@Kaltsoon
Copy link
Collaborator

Thanks for the feedback! Could you specify what kind of description would have made exercises easier? Doesn't for example this example answer the question "how to work with a components properties from within the event handler":

const App = (props) => {
  const [ counter, setCounter ] = useState(0)

  return (
    <div>
      <div>{counter}</div>
      <button onClick={() => setCounter(counter + 1)}>
        plus
      </button>
      <button onClick={() => setCounter(0)}> 
        zero
      </button>
    </div>
  )
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants