So we worked on these forms here or on these inputs where we can fetch user input for adding new products
and that of course is a core thing you'll probably have to do in any application.
Now here, I showed you all the nitty gritty details it takes to set this up from scratch on your own
and of course this is only one possible approach. You could have managed all the state individually with
multiple use state states in one component. Here instead, I use use reducer and this merged state to have
all the state that belongs together together and I use a separate component for the actual input
and its label and the error text and the validation of this input text
and of course that's also just one possible pattern. Now in production of course, you might not
want to reinvent the wheel all the time,
so instead of writing all that validation logic manually here, as I mentioned already, you might want
to check out solutions like ValidateJS which gives you preconfigured validation patterns and functionalities,
so that you don't have to add your own email regex and so on.
You can also look into packages like formik which is a third-party React package that also works
for React Native which makes adding forms and validating forms even easier
and you can check out the official docs to learn more about it and to also learn how to use it in React
Native apps because you'll find a description about that there.
However, I found it more interesting to show you what happens behind the scenes and how you can set up
something like this from scratch because ultimately this course is about becoming a developer and not
about becoming a copy and paster I guess.
So I hope this was helpful for understanding what's happening behind the scenes, how you can manage validity
and values elegantly and in a reusable way
and we will also reuse the inputs later in the authentication section once we also add an authentication
screen and there, we will then also see how easy it is to add yet another form to this application.