What does it mean when it's said React is declarative?
Declarative: What to do and where to do Imperative: What to do ,where to do and how to do.
React is declarative which is basically opposite of imperative in english language. It means that we don't need to provide how a particular task will be done ,but rather what i want to render and where i want to render.
As shown in the below code ,while rendering the h1 using vanilla javascript we need to provide commands for how the h1 would be created. But while using React ,we don't need to do so, we just add h1 and render it on the webpage.
That's one of the main reasons why React is so popular.
Look in the picture below for more clarity