Accessing computer's localhost from Android emulator

Two ways to access your local computer’s localhost Using IP 10.0.2.2 in emulator Using localhost text in the emulator Using IP 10.0.2.2 This is straight forward, open browser in the andriod emulator and go to http://10.0.2.2 it will point to your computer’s localhost. To access your computer’s localhost from an Android emulator using “localhost,” you can use the special IP address 10.0.2.2, which is an alias to your host machine’s loopback interface (localhost)....

September 16, 2023 · 4 min · 689 words · M.Kumaran

Web push notifications

This tutorial is based on a youtube video Web Push Notifications - End to End implementation Initialize server code create new folder called server run npm init command inside that server folder. After running the npm init command you can see package.json file inside the server folder. we need to install a npm package called web-push so run npm i web-push after running above commands, your server folder should be like this...

December 24, 2021 · 3 min · 624 words · M.Kumaran

Best way to do async request (ajax and side effects) in ReactJs using hooks, Redux style - useReducer()

How to fetch data with React Hooks? You will mostly end-up with Robin’s blog post regarding the fecth method. But the problem using useState() is that we can’t execute any other code after fetch success. for an example:- do one fetch, if that fetch is successfull then call some JavaScript like clear the form using useState(), if fails display error message. That’s somehow difficult if we use useState(). fetch using useState() I created a codesandbox based on best practices to fetch data using hooks....

May 26, 2019 · 3 min · 556 words · M.Kumaran