Managing React Native Form State with Redux-Form

Chances are, you have had to implement some kind of a form while developing your mobile apps. It may be a simple login form or a complex reporting system, nevertheless, you will face some challenges. How do you validate the data? Where do you store the form state? How do you control the form’s lifecycle? Answers to these and many other questions are waiting below, where I tell you how to use Redux Form with React Native.

read more “Managing React Native Form State with Redux-Form”

Advanced testing in React Native with Jest: Redux integration

This post is part of my series on unit testing with Jest in React Native. You can find the introduction here.

By now you should have a solid understanding of how testing works in React Native. But there is one important concept left to go over, that is integrating redux into your tests. Redux is the industry standard for global state management in React applications. Even though React Context is supposed to replace Redux, it is not there yet. So how do we test Redux-connected components with Jest and react-native-testing-library?

read more “Advanced testing in React Native with Jest: Redux integration”

Advanced testing in React Native with Jest: Components

This post is part of my series on unit testing with Jest in React Native. You can find the introduction here.

In the previous parts, I went through why unit testing is vital and how to test your components using snapshots. While snapshot testing is effective, it fails to test some aspects of the component. Now I would like to talk about more advanced component testing in react native.

read more “Advanced testing in React Native with Jest: Components”

Advanced testing in React Native with Jest: Mocking

This post is part of my series on unit testing with Jest in React Native. You can find the introduction here.

While unit testing your code with Jest, you may come across a time when you have to emulate a certain function. For example, the fetch function that performs HTTP requests, or some hardware-related routines. In such cases, you have to use mocking. Thankfully, jest supports various mocking styles out of the box.

read more “Advanced testing in React Native with Jest: Mocking”