React is a JavaScript library for building user interfaces. It’s used to design web apps. It is a declarative language for HTML UIs that represent dynamic data. It creates a virtual DOM and manipulates the HTML DOM in any UI changes.

Raw Code vs React Code:

with web DOM API

document.getElementById(‘title’).innerHTML = `
Hello HTML

with React’s API


1) Always we use the toUpperCase() or, toLowerCase() method to convert a string into capital or smaller letter. But, if we need to convert only the first letter into the capital letter, we need to use:-

const name = ‘badhan’;console.log(name[0].toUpperCase() + name.substr(1, name.length));or,newName = name[0].toUpperCase() + name.substr(1, name.length);console.log(newName);

2) To check whether a word is present or, not,

const sentence = ‘The quick brown fox jumps over the lazy dog’;console.log(sentence.includes(cat)); //falseconsole.log(sentence.includes(dog)); //true

3) To remove Unnessacery white space of any user input,

const input = ‘ This is JS Magic ’;console.log(input.trim()); //This is JS Magic

4) Easy Way to concate two string

const str1 = ‘Hello’;

Badhan Chandra Barman

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store