top of page
Logo der Online Agentur mdwp

Vanilla JavaScript

Vanilla JavaScript isn't actually a term specific to React.js but rather a universal term used in web development. It simply refers to plain, pure JavaScript - no frameworks, no libraries, just raw JavaScript.

When you're referring to "Vanilla JavaScript" in the context of React.js, it means that you're using JavaScript without any additional tools or libraries like React.js itself, JQuery, Angular etc.

React.js is a library built on top of Vanilla JavaScript to make the building of user interfaces easier. While React simplifies a lot of things, being proficient in Vanilla JavaScript helps you understand what's happening behind the scenes.

Let's consider an example:

A code snippet of Vanilla JavaScript to add an element to the DOM would look something like this:

var newElement = document.createElement('h1');
newElement.textContent = 'Hello, this is a new element';

While the same function in React, would look something like this:

<h1>Hello, this is a new element</h1>,

In the Vanilla JavaScript approach, we're using the basic JavaScript API for interacting with the DOM. In the React example, React is handling the DOM manipulation for us.

bottom of page