Skip to content
Justice Tech School

Passing Arguments to Handlers

Wrap the call in an arrow function to pass arguments.

Example
function List({ ids, onPick }) {
  return ids.map((id) => (
    <button key={id} onClick={() => onPick(id)}>Pick {id}</button>
  ));
}

Exercise

Arrow wrapper.

onClick={()  onPick(id)}

Quiz Test

Why wrap in an arrow?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.