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.
SubscribeRelated
renderfireEventcontainercleanuprerenderunmountasFragment