Parsing React: How It Works

Can anyone tell me what’s going on with React? How is it possible to have HTML tags mixed with JS syntax? Is there some kind of JS-driven, pre-parsing voodoo that the library performs on my code before it passes it along to the JS interpreter?

Same sorcery as PHP: you drop your html inside React and it manages and renders it.

and yes, you are correct , the voodoo happens in the background:

Take a look: React (JavaScript library) - Wikipedia

1 Like

It’s actually a new part of the standard but I believe it started with people adding in their own interpreter. Trust me, you want this feature in React. Early react was this nasty pile of garbage where you hand crafted HTML with a gross verbose API.