Image for post
Image for post
Photo by Matthew Henry from Burst

Recoil is React’s best solution so far for global state management. It’s lightweight, simple and performant approach to communicating between components provides a better experience for both the user and the developer than previous libraries like Redux or RxJS. However, the project is very new, and lacks the years of community involvement to produce standard best practices for setting up your project with an eye towards scalability. What follows here is what I’ve found to work best for a large React Native and React Native Web hybrid application.

Problems With Prevailing Structure

Most of the Recoil examples I’ve seen others produce on the web…


Image for post
Image for post

React has a lot of patterns that new developers need to memorize when they’re getting started. I’m going to go through some of them that I’ve found useful over the past few years, starting with those I think are the easiest to grasp and the most useful, then give code examples that you can use as templates for your own work.

Functional Components

There’s three ways to declare a React component: as a functional component, as an ES6 class, and calling React.createElement. Of these, the functional component is the most terse and is the easiest to understand:

Thanks to ES6 arrow…

Wesley Rast

Software Architect

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store