L
L
lil_web2020-03-31 14:13:48
Unit testing
lil_web, 2020-03-31 14:13:48

How to test a generic Input component?

I am writing a React web application. Moved the text input field into a separate component Input. When it is needed, I pass the state and the state setter in the props.

I am writing a unit test for Input. I don't understand what to do with setValue, because my state is outside the component. Help me please.

Code in the online sandbox

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question