Chapter 1. React Component Patterns
The development for Android an iOS has never been easier than now. React Native has changed how fast we develop new apps and deliver value to the end user. Knowing this technology will give you a great edge on the market. I'm Matt and I'm happy to show you the best practices I have learnt while working in a React Native ecosystem. Through this book we will explore design patterns by example. In just this first chapter we will create over 10 small applications. Later on in the book we will create more complex applications as we learn new things.
In this chapter we will explore React patterns that also apply to React Native world. The most crucial patterns you need to understand are stateless and stateful components. Understanding how to use those will make you a much better React Native developer and empower you with standard patterns in every React Native application.
When it comes to components it is crucial to make them as reusable as possible and follow the well-known programmer principle – DRY: Don't Repeat Yourself. Presentational components and container components are meant to do just that. We will dive into them with a couple of examples to learn how to split the features into reusable pieces.
To be more precise we will look at the following topics:
- Stateless and stateful components with short and then more complex examples
- When and why use different types of components
- How to create reusable and easily configurable presentational components
- Container components and their role in encapsulation of features
Time to act on your side. Prepare your environment for React Native development right now if you want to follow along and play with the examples. Make sure that you can check the Hello World text on your mobile or simulator.