Learn the essential steps for manually creating a modern ReactJS project, including file structure, dependencies, and core packages. Understand the basics needed before diving into application development.
When starting a React project from scratch, which file is typically created first as the entry point for the application?
Explanation: index.html is the standard entry point, housing the root element where the React app will render. main.js and App.jsx contain JavaScript or JSX code, but do not serve as the entry container for the DOM. style.css is for styling, not initial structure.
What is the purpose of importing both the React and ReactDOM packages when setting up a frontend project?
Explanation: React is used to create and structure components; ReactDOM is explicitly required for rendering these components into the browser's DOM. The distractors confuse their purposes or are unrelated to their true roles.
Why is a tool like Parcel or another JavaScript bundler used when building a React application from scratch?
Explanation: A bundler processes JSX, bundles modules, and manages dependencies to ensure the code works in the browser. Adding styles is not its main purpose; it does not replace package.json or generate HTML files without scripts.
Which command is typically used to manually add React dependencies to a new project using a Node.js package manager?
Explanation: npm install react react-dom is the standard command to add React and ReactDOM manually via npm. The other options are either incorrect syntax or imaginary commands.
What does a basic functional React component return to indicate what should be rendered in the browser?
Explanation: A functional React component returns a JSX element, which is then transformed by tools like Babel for browser rendering. CSS selectors are used for styling, JSON is for data, and raw HTML strings are not returned by React components.