Tag: react

Testing React Components with React Testing Library

Testing react components with React Testing Library can be tricky, so I decided to try something new and put together a video demonstrating how to test your react components. I’ll work on improving the audio quality going forward, but I’d love to know your thoughts! Wanna see more content like this in the future? Lemme… Read more »

Managing Authentication with React’s useContext Hook

Contexts are a commonly used tool when building React libraries, but are often overlooked when building an application in React. I don’t believe that should be the case, as useContext can provide you a powerful alternative (but lightweight) alternative to tools like Redux when managed carefully. The classic example of using a context is to… Read more »

Understanding React Lifecycle Methods

React Lifecycle Methods are one tricky piece of business, especially if you’re coming from a framework that doesn’t have their own. Thankfully, they’re fairly similar to Android’s lifecycle methods and it wasn’t long before I was able to grasp them. React has changed a lot over the past few years and it’s lifecycle methods are… Read more »

How do I use TypeScript with React?

React is allowing developers to iterate faster and build safer, more reliable frontend applications than we were building many years ago. TypeScript, a relatively new addition to the “JavaScript Alternatives” scene, also aims to add a new level of safety in the form of type safety. Naturally, it makes sense for us to want to… Read more »

Fetching Data with React Hooks

React hooks have changed the way that I (and arguably the React Community) prefer to build components. I’ve been working on a GraphQL project for a while, and when we migrated to functional components and hooks, I was able to use Apollo’s hooks for my data fetching needs. However, I find myself now working on… Read more »

Autosaving with React Hooks

React hooks have really changed the game for me when it comes to building react components. However, I’ve found that writing autosaving functionality is a little less obvious via hooks. Thankfully, it is still possible (and arguably a lot cleaner) when using hooks. We can accomplish autosaving functionality through use of useEffect. You’ll also need… Read more »

Auth Guarding React Router Routes

A common theme in web applications is to serve specific content to authenticated users while serving other content to everyone else. I’ve heard this referred to in the past as “auth guarding” specific content. In this case of our example today, we want to auth guard react-router routes. There are a couple of different ways… Read more »