The ultimate guide to JavaScript class pattern explains how the prototype chain works. It explains how we can chain multiple prototypes together. However, for the sake of simplicity, I left out how a put operation on an object property works. Most misunderstandings in JavaScript arises from the assumption that the put operation works similarly to the get operation. Unfortunately, that is not how it works.…
Author: Vijay Thirugnanam
Consider an empty object. Print the object using toString
method.
const obj = {}; console.log(obj.toString()); // [object Object]
We get the result [object Object]
in the console. How does it work? (Interview question). Developers who have a strong background in C++ or C# will blindly attribute it to OOPs. All objects inherit from Object.
…JavaScript is to Java what Cartoon is to Car.
Yesterday, I had an interview on JavaScript. As a React developer, I do not have practical experience with these questions. But, the interview questions are interesting to know.
Global this
What is the value of this
in global scope? I have not really tried it before. I gave an answer. Maybe, it points to the window object. It turns out to be correct.…
Heroku makes it easy to deploy an app via Docker. On building a React app, the distribution folder has index.html
, bundle.js
, styles.css
and images folder. Utilities like serve
helps to serve static files from the distribution folder.
Building the Docker image
I am assuming that you are familiar with Docker: image, container and registry. Dockerfile builds a new image.…
The github repo, react-webpack, has the minimal scaffolding for a React web app with Webpack 4. The tutorial explains how the project was built.
New project
Create a new project
yarn init
Install Webpack as devDependency.
yarn add webpack webpack-cli webpack-dev-server --dev
Create Webpack configuration file:
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
… This is the third part of the tutorial series on push notifications for an Android react native app. We are building the Retweeter app. And we are all set to give the finishing touches in this post.
In the first part, we covered how to configure react-native-firebase
and get the FCM token. We learnt how to send a push notification manually from the Firebase console.…
This is Part 2 of my tutorial on Push notifications. Please click the link for Part 1 of the tutorial. We are building a Retweeter app. The Retweeter app is a React native app which displays a list of tweets it receives from a push notification. The user has an option to retweet some of the tweets.
In Part 2, we are going to build the server infrastructure for push notifications using AWS Lambda.…
Push notifications was originally an iOS concept. Apple has a push notification service called APNS. App that wants receive notifications should register with the APNS. A server component should send notifications to APNS directed towards one or more devices. The app receives the push notification from APNS and does one of the following actions:
- Display a notification or short text message
- Play a sound
- Update the badge in app icon
- Allow the user to perform an action
As you can see, push notifications are a powerful feature in iOS.…
I used to have a .NET blog previously at the same URL. The .NET blog was active for 6 years before I switched to WordPress last year. After the move to WordPress, I am writing articles on React ecosystem. If you are a reader of my blog and / or came to the page accidentally, I want to request you to comment on what topics you want to see in the blog.…
What is a HOC?
Higher Order Component (HOC) is a function which accepts a base component and returns a decorated component.
const hoc = BaseComponent => props => ( <BaseComponent {...props} /> )
The component that the HOC returns is a stateless functional component. At its most basic form, the base component is rendered with all the supplied props. The props can be overridden by a variation of HOC which accepts an option or configuration.…