React Flashcards
(61 cards)
What is React?
A popular client-side (front-end) web framework for building complex web applications.
Where does React run?
In the client’s browser.
What does Next.js do?
It extends React to work on both the client and the server.
What is a component in React?
A self-contained piece of code representing a region on a webpage, managing its own content, presentation, and behaviour.
What enables dynamic updates in React components?
- React components can change their appearance and behaviour dynamically by manipulating the virtual Document Object Model (DOM).
What is the Virtual DOM?
A virtual representation of the DOM that React uses to determine efficient updates to the actual DOM.
What is a Single Page Application (SPA)?
A website built with one HTML page and updated dynamically using JavaScript (e.g. via React).
How are React components similar to HTML?
They are expressed as nested collections of elements, like HTML tags.
What is the key difference between React components and HTML elements?
React components are reactive and dynamic; HTML elements are static.
Name three common HTML tags used in web apps
<div>, <input></input>, <table>
</table></div>
What are some attributes used in <table> tags?
border, cellpadding, cellspacing, and inline styles.
What is the limitation of static HTML pages?
They cannot respond to user input or change dynamically.
How does React improve on static HTML?
By using dynamic, programmable components instead of static tags.
What are other popular front-end frameworks besides React?
Vue, Angular, and Svelte.
What is Node.js used for in React projects?
It allows JavaScript to run outside the browser, like on a server or local machine.
What is npm?
Node Package Manager, used to install and manage packages.
How do you check Node.js and npm versions?
Run: $ node –version
$ npm –version
How do you create a new React project using Vite?
Run: npm create vite@latest ecommerce-site – –template react
What is Vite?
A fast, modern build tool for front-end frameworks like React.
How do you install and start a development server in React?
Run: npm install
then
npm run dev
What is the purpose of npm install?
It installs dependencies listed in the package.json file.
What do the main files and directoriesin a React app contain?
- index.html: The main HTML file.
- package.json: Lists the package dependencies for the project. Used by npm install to determine which packages to install.
- public: Contains static assets like images
- src: Contains the source code of the application.
- vite.config.js: Configuration file for Vite.
How do you run scripts defined in package.json?
Using npm run
What does npm run dev do?
Starts the Vite development server.