Considering how loosely coupled web development is these days, leading to a separation of the frontend (mostly SPA) and backend(API driven) of our applications and often handled by different teams, one major thing to consider is the “blocked factor.”
The blocked factor is how long a developer spends waiting on external API dependencies, hence preventing a feature development on the frontend or a project altogether.
Mocking is a way out of this blocked factor. They are easy to write, flexible, and stateless (hence testing scenarios repeatedly is easier) and ultimately provide a way out of external API dependencies.
In the previous article, we explored props drilling and how it can be used using composition in React.
Let’s assume I am a team member, and I discovered a card component that we would use everywhere in our application. Let us build it together.
Great! The card component does its job well and is well structured. Everyone is happy and went by calling the card component. Easy life!
Let’s imagine after a month, a teammate writes to me and says the following.
Hey Tife, I discovered the card component while going through the docs and it is great. It…
React implements a unidirectional pattern for data flow for building components. The pattern itself is not unique to React but is followed strictly.
Unidirectional data flow simply means that data can only flow in one way alone.
Following the definition — and if experienced with React — you would have noticed that the child component cannot pass data to the parent component; hence, data only flows in one way, “FROM the parent TO the child.”
If we need to modify the child that influences the parent or shares state between two child components, we use props.
Let’s see a small…
You can get part one of this article here. It focuses on Mocking APIs for frontend developers.
In the words of Kent C. Dodds.
The more your tests resemble the way your software is used, the more confidence they can give you. — Kent C. Dodds.
While writing tests, it is best to focus on the use cases of our applications. This way, our tests mimic our users, and we are not focused on the implementation details.
Since we are testing for our application use cases, it is important to test for the interaction with data (Hence API requests).
reading through, I could only appreciate the braveness writing about this. I learnt something important and crucial which is, I need to be involved in the company success and not the shiny new project alone and also asking for constant feedback. Thanks for sharing.
Software engineering is an ever-evolving industry with various challenges faced by engineers or programmers. One of such is writing scalable and maintainable code.
One of the approaches taken towards a maintainable codebase is the abstraction and reusability of code to prevent duplications everywhere in our code. This is commonly referred to as DRY (DON’T REPEAT YOURSELF).
Let’s consider an example:
This function is a simple one. It takes in an object and an array of keys, and if the object holds any of the keys, remove that object entry.
This function belongs closely to this use case and can be…
In the first part of this article, we focused on creating GitHub actions for the build and lint of our Go application.
In this article, we will be containerising our application using docker and preparing it for deployment using Terraform as our tool for infrastructure as code to AWS.
Let’s create our docker file.
Here we will be using a multi-build stage to significantly reduce our application size.
The stages are actually well commented but I will explain certain stages.
We are running golang:alphine as builder. Alpine Linux is…
In this article, I want to show how we can implement a two way authentication system which involves the use of OTP in validating a user.
We need to setup twilio as well as a 3rd party API for sending OTPs to the clients phone as a message.
If you are using a free version, you might have some restrictions regarding sending to more phone numbers.
With an upgraded version, there are three things that are important:
We can use the following helper function below to send OTPs. …
Building APIs are no easy tasks, ranging from complex algorithms to CORS (every developers nightmare), developers are faced with difficult tasks daily to get the best product out there and solve problems. Another pain point experienced is deployment.
Deployment of applications especially to various environment like staging and production adds another level of complexity to this tedious process where we deploy and simply hope for the best that nothing with fail.
Deployment these days shouldn’t be subject to guess works, inconsistencies and human error with great tools out there such as docker for containerising and configuring our application, Github Actions…
A frontend developer, while at that, just a curious cat that loves to share what he knows.