Image for post
Image for post
Photo by Micah Williams on Unsplash

Authentication is hard! Nowadays, to create a simple login or logout feature, we require a considerable amount of boilerplate code. Now picture we want to add authentication with Google or Facebook? More boilerplate, right?

What if I told you that in React you can do that just by wrapping your code with a context provider and by using a custom react hook?

In this blog post, I’ll show you how to add authentication to your React application using the Auth0 useAuth0 custom hook, how to display the authenticated user information, and how to authenticate with a social provider like GitHub.


Auth0 dashboard

So the first thing you need is an Auth0 account. …

It is that simple to manage server state.

Hey everyone, I’m making this post to share with you a library that made managing server state on React applications easy and fun — React Query.

In this blog post, I’ll do a small introduction by explaining what led to its creation followed by an introduction to how the useQuery hook works. I’ll end this post by showing some custom configurations we can do, and how we can do cache invalidation, data refetching, and optimistic updates.

Image for post
Image for post
Photo by Fachy Marín on Unsplash

Until now, many React applications have been relying on global state as a way to share data between components and avoid prop drilling.

Despite this apparent advantage, global data is often poorly used, and often is used without thinking if what we are adding there should be global to our application. Another thing that often happens is mixing server state with the client state. So what is the difference between client state and server state? …

Lessons learned: are React hooks ready for the real world?

Image for post
Image for post
(Photo by Dawid Zawiła on Unsplash)

More than a year has passed since the release of React Hooks. By now, we know all the basics and perhaps have our apps using one or two of them.

This post consists of an agglomerate of tips and pains suffered while trying to migrate from a full-fledged pre Hooks app to a Hooks using one.

Some context

At Talkdesk, in the past year, the WFM Frontend Team decided to migrate their React application to functional components and start using React Hooks.

At the time it seemed a controversial decision. …


Daniel Afonso

Software Engineer. Nerdy, loves to code and wants to learn everything.

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