Bare with me, let me explain the scenario first.
Imagine you need to do something, i.e. call a function when a state updates, easiest way in React would be to use
React.useEffect and use the state as the dependency so the hook fires every time the state updates.
But according to the documentation, the dependency array should contain things i.e. functions and state being used inside the hook that are declared outside its body so that the hook has the updated dependencies it is using.
What if we don’t want the
React.useEffect to be called every time the rest of…
Starting with Vim feels scary and it is, considering the fact that my typing speed went down quite drastically because i was not used to vim, but now that i’m getting a hang of it, it almost feels like it is saving me a bunch of clicks and it’s doing what it is supposed to be doing, helping me use mouse a lot less! Following are the list of things I have been using:
I have an added an extension
vimto enable vim in Visual Studio Code because It is after all the best code editor you can find.
These keybindings somewhat resemble VIM bindings because they are inspired by them. But I have tweaked them for my ease as i did not really like changing modes and
hjkl really did not feel that great tbh. Keep in mind, this is my opinion and it might not align well with yours.
Recently, I have been creating small static website and I’ve been using Github to host them, so I thought I should document it so in future, I can get back to speed if I for some reason forget how it is done. And trust me, It is fairly easy and straight forward.
For this, you obviously need a Github account and basics of Git but don’t worry, all the commands and why they are required and what they do will be in this article.
If you already have a project and Github repository set up, go to section ‘Hosting on…
While creating a new react project with typescript by running the command:
npx create-react-app . --template typescript
I stumbled upon the following error:
uninstall typescript and install email@example.com
npm uninstall typescript
npm install firstname.lastname@example.org
My package.json file:
In short, these are the functions either accept functions as parameters or return functions as output.
arr.map() and arr.filter() are two Higher Order Functions I can think of right now that accept a function as a parameter.
When using Redux in react, you’ve probably used connect(), so it…
Publishing on npmjs.org
We’ll divide it into two steps
If you’re facing any issues, we’ll be discussing them at the end of the article but read the article first, you might find the answer you’re looking for in it too.
If you have not registered yourself at npmjs.org, now is the right time for it. Go to https://www.npmjs.com/signup and sign up for an account.
After you’re done, login at https://www.npmjs.com/ and they’ll send a verification email on the email address you provided while signing up.
Setting up using TSDX….
Yesterday I was working on React.js Project and I was using Typescript and I thought wouldn’t it be nice if I could create and publish my own packages (written in typescript) on npmjs.org.
TLDR: I found out about this package tsdx. It sets up the environment so you can start writing your own npm package right away!
All you have to do is run the following command to set up your package.
npx tsdx create <package-title>
// replace <package-title> with the package name that is unique.
Please, pick a name/title/package-title that is unique, you can easily…
Arbaz is a MERN Stack developer, aiming to make learning programming accessible and straight forward