How to write unit tests that check if you’re routing requests correctly using React Router with Jest

Image for post
Image for post
Photo by Jean-Philippe Delberghe on Unsplash

Writing a unit test that checks if React Router is correctly configured to route requests in your app seems simple enough. And admittedly, it doesn’t take much code to do it. But that doesn’t mean it’s easy to figure out. My online search didn’t produce any out-of-the-box code examples and I spent several hours trying to get a decent working solution for this problem.

If you’re facing the same challenge, here’s what to look out for. Note that the solution is written for a React app that uses functional components. …


Image for post
Image for post
Photo by Ugo Mendes Donelli on Unsplash

When it gets too complicated to share the state between all React components that need it, Context comes to the rescue. Here’s a short guide on how to use context with functional components and hooks in React.

When shoud you use React Context

React’s Context is a solution for use cases where you need to share state between multiple components. Without Context, all components that want to use the same state would have to have a common parent component that would pass the state down through props.

This is fine if there are few components that need to use the same state and they all have…


Accidentally pushed your changes to the wrong branch? Yeah, it happens to me as well. And instead of searching for the solution online every time it occurs, I started writing down the git commands and workflows I use to perform common tasks.

This article will cover git commands for the usual scenarios you encounter when working on a git project, from the basics of how to clone a repository and create a separate branch to handling common issues such as committing to the wrong branch or copying a single file from a different branch into the current one.

Cloning the repository

The first…


Is Application Gateway the right load balancing solution for your project?

Image for post
Image for post
Photo by Camylla Battani on Unsplash

Azure Application Gateway is an application layer (OSI layer 7) load balancer. It offers a range of functionalities such as routing based on various attributes of HTTP requests, HTTP header rewrites, Azure Web Application Firewall (WAF) and SSL termination. However, it does come at a price and it can be a bit daunting to configure.

The aim of this article is to help you decide if Application Gateway is the right solution for you and how you can configure it. It’s based on my experience with setting up an Application Gateway that routes traffic to a Service Fabric cluster and…

Dunja Vesinger

Software Engineer. Passionate reader. Aspiring writer.

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