Menu

Post image 1
Post image 2
1 / 2
0

Basic about react components,Jsx rules, React folder structure and SPA vs MPA

DEV Community·Deva I·18 days ago
#fOgtAhk6
Reading 0:00
15s threshold

Deva I

React components:

Components are like functions that return HTML elements.

Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML.

Key characteristics:

🔹Reusability: You can write a component once (e.g., a Button or Header) and use it multiple times throughout your application.

Independent Logic: Each component manages its own logic, such as handling clicks or data.

Composable: You can nest components inside other components to build complex interfaces from simple parts.

Naming: component names must start with an uppercase letter to distinguish them from standard HTML tags.

They are two types
1.class components
2.functional components

Class components:

▪️It is the older version and this not recommended for new projects.

functional components

▪️Simple JavaScript functions that return JSX. They are the modern standard because they are easier to read and use Hooks to manage state.

Read More