Today I Learn Difference btwn JS (vs) JSX & Library (vs) Framework...
Chithra Priya

Chithra Priya @chithra_priya

Joined:
Apr 29, 2025

Today I Learn Difference btwn JS (vs) JSX & Library (vs) Framework...

Publish Date: Jun 13
1 1

>>>>>>> Fragment[TBD] <<<<<<<<

Difference between JS vs JSX:

JS(JavaScript):

What it is: A standard programming language used for web development.
Used for: Logic, data handling, functions, event handling, etc.
Syntax: Pure JavaScript syntax (e.g., if, for, function, etc.).
Example:

const name = "Priya";
console.log("Hello " + name);
Enter fullscreen mode Exit fullscreen mode

JSX (JavaScript XML):

What it is: A syntax extension for JavaScript used in React.
Used for: Writing HTML-like code inside JavaScript.
Looks like: HTML but works inside JavaScript.
Example:

const element = <h1>Hello, Priya!</h1>;
Enter fullscreen mode Exit fullscreen mode

Key Differences:

In React, you use JSX inside JS:

function App() {
  const name = "Priya";
  return <h1>Hello, {name}</h1>; // JSX inside JS
}
Enter fullscreen mode Exit fullscreen mode

JSX makes writing React components easier and more readable.

Library:

  • A library is like a toolbox.
  • React is a library that helps you build user interfaces (UIs).
  • You decide how to use the tools (how to organize your app, when to call functions).
  • React doesn’t control your whole app – it just helps you build parts of it, like buttons, forms, etc.

Framework:

  • A framework is like a ready-made structure or a blueprint for building an app.
  • It controls the flow of your app and tells you where to put your code.
  • You build inside the framework, following its rules and structure.

In Programming:
Framework = “I will call your code at the right time.”

Components:

In React, a component is like a reusable building block of your user interface.

Example:

function Welcome() {
  return <h1>Hello, welcome to my site!</h1>;
}
Enter fullscreen mode Exit fullscreen mode

Component have two types:

  1. Class components
  2. Functional components

Comments 1 total

  • Admin
    AdminJun 13, 2025

    Hey authors! We’re thrilled to announce We're offering a limited-time token giveaway as a thank-you for your contributions. Click here here (instant distribution). – Dev.to Team

Add comment