Multiple stores

Handling multiple stores in a React-Redux application

In a react-redux application, it is a good practice to have only one redux store. But if for some weird/“special” reason if you have to have more than one store, you will face some problems. The most common problem is that if we wrap a component with a provider and then wrap a child component with another provider, it’s not easy to subscribe to the store of top-level provider. const Component1 = () => { return ( <Provider store={store1}> <Provider store={store2}> <Component2 /> </Provider> </Provider> ); }; It’s so confusing that within a few iterations of development, you’ll find yourself using providers on each component, and not being able to read values from both the stores in a single component will frustrate you....

October 12, 2021 · 2 min · Vikas Kumar

Difference between 'useEffect' and calling function directly inside a component.

In React, the useEffect hook is pretty straightforward. But its simplicity sometimes makes me forget its actual function. I remembered useEffect simply as something which takes a callback and a dependency array as arguments, and it will execute the callback whenever the dependency array is changed. And in case of no dependency array, it will run the callback each time the component renders. But then what will be the difference between the following two cases....

May 9, 2021 · 3 min · Vikas Kumar
OneSignal ReactJs

How to use OneSignal with ReactJs

Using OneSignal with react is fairly easy if one doesn’t care about existing service-worker. But if there is an existing service worker, things may not work as is expected. First, we will create a react app with a service-worker. npx create-react-app my-app --template pwa This should create a folder named 'my-app' containing all the app-related files. To check everything is fine, we can run the following commands, and a browser tab should open with the ReactJs logo....

January 9, 2021 · 3 min · Vikas Kumar
VPN

Public VPN is not what's it advertised as

In the last few years, there has been a flow of public VPN services in the market. But there are now a lot of myths and misinformation about it is floating in the market. Sadly, this misinformation is being propagated by the company itself and knowing unknowingly by tech YouTubers who frequently gets sponsored by the Public Providers. Here I am listing a few of the things these services can offer and some which these can’t...

December 19, 2020 · 2 min · Vikas Kumar

How to create UPI Payment link in HTML

TLDR - The URL scheme is upi://pay?pn=<Name>&pa=<UPI ID>&cu=<Currency Code> ...

November 6, 2020 · 1 min · Vikas Kumar