Hi there! About two years ago I wrote a blog about testing React Function components with hooks using
enzyme and here I am writing about the same with a new perspective.
TLDR; Here I’ll let you know of a way that I learnt to test the lifecycle hooks such as
useEffect and redux hooks namely
useDispatch while shallow mounting components using
Hi there! Yes! The answer is definitely yes! You read it right. I’m writing to tell you about an extremely efficient way of preparing your presentation slides and it doesn’t involve using Google Slides or Microsoft PowerPoint.
Before I jump into how, let me quickly delve into the why. So I had to conduct a workshop on React which spanned over 6 days which meant that I had to have my slides prepared for all 6 days of the event. I knew preparing it on Google Slides would be a nightmare for me since I have an over average level…
If you’ve been using redux for years you’ve been familiar with the connect() Higher Order Component that jumbles up the flow of props in your code and makes you constantly scroll the page in order to understand whether the props in the component are actually just real props or something that we added in later from the store. It is a huge problem with class based react components where there is no other option but to embrace this chaos.
I always felt the class based components addition of unnecessary complexity and bloated code with lots of things you’d need to remember…
Let’s start! I’m sure you’re here probably because at some point you have run into this problem of how you should be documenting a piece of code that you wrote. If you’re just documenting APIs the API docs like swagger would help but it doesn’t help in documenting the logic.
It’s not just you who is guilty of spending a wholesome amount of time just figuring out the application that you’d be using. Yup! I too did feel like Google docs just didn’t cut it out for me. …
Hey friend! You must have heard of the clip-path property in css. No? Then you might be in for a treat. If yes wouldn’t you agree that it’s quite awesome and I would assume you landed here wondering where you could use it in your application. Here I’ll give a few use-cases with examples that would help you get started with using clip-path property in your application and the rest you can easily figure out.
clip-pathCSS property creates a clipping region that sets what part of an element should be shown. …
A React Function Component is simply a function that returns a React element. With React 16.8 the most awaited feature, hooks was introduced which allowed for injecting state and lifecycle methods into stateless function components and make it stateful. The simple syntax and plug and play ability of hooks made writing function components quite enjoyable and made writing class based components feel a bit cumbersome.
Consider this simple React function component implementing hooks:
So it was one of the few weekends that I have every year that I go out to have a haircut. After getting a haircut I expressed gratitude by saying thanks to the barber. I felt good because I saw a slight smile on his face when I said that. As I was walking down the street wondering how little things make a big difference, I saw a sadhu (I could tell from his red attire and necklace of rudraksha beads) But I felt that something was off about him (maybe it was his well built physique as the sadhus…
I’m tired of setting myself on fire just to keep others warm.
You never cared, not even a damn fuck though I meant no harm.
Even though everything was in Chaos I tell you, I managed to stay calm.
It’s not that I wanted something in return,
but some insight would have been fine.
I think it wasn’t much to ask but who knew I wasn’t even worth your time.
I used to think everything happened for a reason.
I used to think! “Everything happened for a reason!”
But who would have thought Your friendship was just a season…
Fetching the data in the web is an asynchronous task which is dreaded by many due to its a-synchronousness. Generally we have a tendency to write callbacks to handle asynchronous functions because it’s easier to write and understand. It might work when you have a few asynchronous functions to execute but as the code base starts growing and/or if there is a need for large number of asynchronous functions to be executed, you’ll have asynchronous functions passed as callbacks to asynchronous functions recursively. Lets consider this example