Created a Context API to switch between light mode and dark mode

Introduction

React Material UI is a material design library built using React js that also supports Typescript.

Material UI has many UI components with working examples that make react developers life eaiser when they start integrating material UI components on their react projects.

One thing that I badly miss in React material UI is the support for the dark mode feature.

If you look at the material UI official documentation website, it has a toggle button to switch between light theme and dark theme.

That inspired me to create…


JavaScript- Array.prototype.includes() vs Array.prototype.indexOf()

Adinclude() method over indexOf() method in javaScript

Photo by Caspar Camille Rubin on Unsplash

Array.prototype.includes() method was introduced in ECMAScript 2016 (ES7). This method is for determining whether a given element exists in an array or not. It returns true if first occurrence of the element is found in the given array else returns false

Array.prototype.indexOf() method returns the first index of the searched element present in an array, however -1 is returned if the searched element is not found in the given array.

2 big problems you might encounter when using indexOf() method to find an element in an array:

  1. indexOf method does not say ‘what…

Suraj Sharma

A Full Stack Web Developer

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