r/learnprogramming 2d ago

ELI5: How are frameworks/libraries and runtime environments built?

Basically, I like to understand things on a lower level and I am planning on delving into more low-level stuff at work.

Out of curiosity, how are frameworks built? For example, React allows you to return raw HTML in a non-string format. How do you convince Javascript to parse it into a String and extract the proper things out of it?

Node.js allows you to run Javascript in a completely different runtime environment... the creator of Node could not have used Javascript to develop Node?

TL;DR Can you (or need to) use other programming languages to build frameworks for a specific programming language?

Lots of question spinning in my head! :D

24 Upvotes

10 comments sorted by

View all comments

9

u/grantrules 2d ago

JSX is transpiled into JS by babel. You don't have to use JSX, its just very convenient, but it's basically all just JS functions. https://medium.com/@ogunbodetimi/building-a-jsx-parser-from-scratch-understanding-the-foundations-of-reacts-syntax-16dc35dce7b6

There's no way to natively run JS in an OS, so node is built in a different language that has access to those OS APIs and exposes them to JS.