Wanting to master creating web and mobile applications in React and React Native? You’re in the right place. Although one of the advantages of React

React & React Native: Mastering Design Patterns & SOLID Principles for Effective Software Development

submited by
Style Pass
2021-07-09 12:30:06

Wanting to master creating web and mobile applications in React and React Native? You’re in the right place. Although one of the advantages of React and React Native lie in them being declarative, that doesn’t necessarily mean that you’re going to write the most efficient and maintainable code. In this article, I’m going to take you through how to up your code with design patterns and SOLID principles using an easy-to-follow example and some free code.

Originally, React was advertised as the V in MVC (Model View Controller) but the React team has since discontinued using the phrase. The phrase implies you should use some other technology for the “M” and “C”. Today however you can use the Container/Component pattern. Container in this context acts as the Controller and as the Page/Screen itself (I’m going to refer to Pages and Screens as just Screens from this point.) Containers compose UI and handle the business logic. The pattern itself is reasonable, sound, and necessary. After all, you have to group components up somewhere.

Our early forays into the Container/Component pattern yielded mixed results. It did the job, but there were times when we ran into complexity problems at the Container level.

Leave a Comment