Skip to content
masterclass Buddy

React Testing Library · Matcher

toBeRequired

Test a React input change by rendering the control and calling fireEvent.change with a new target value. Assert that the handler ran and the control has that value.

Last updated

Syntax

fireEvent.change(element, { target: { value: 'new value' } })

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • render
  • fireEvent
  • container
  • cleanup
  • rerender
  • unmount
  • asFragment

Source: FAQ | Testing Library. Checked 2026-11-03.