Learn the essential steps of building a simple 'Hello World' app using React, from installation to customization and production build. This quiz covers key concepts for beginners in modern frontend development.
Which two tools must be installed on your computer before creating a new React app?
Explanation: Node.js and npm are required to create and manage React projects since React depends on the Node ecosystem. Python and pip are for Python projects, Java and Maven for Java applications, and Ruby and Gem for Ruby projects.
What command should you use to set up a new React project called 'hello-react' without installing create-react-app globally?
Explanation: Using 'npx create-react-app hello-react' initializes a React app in a folder called 'hello-react' without global installation. The other options are invalid or outdated commands for modern React app setup.
Which file should be updated to make the app display 'Hello, World!' on the page?
Explanation: The 'src/App.js' file contains the main component that controls what appears on the screen, so editing it ensures 'Hello, World!' is shown. 'public/index.html' provides the root HTML, 'src/index.js' handles entry-point rendering, and 'package.json' contains project settings.
Which command launches the React app locally and opens it in your default web browser?
Explanation: 'npm start' runs the local development server and opens your app, making it viewable on localhost. 'npm build' (should be 'npm run build') is for production builds, 'react launch' is not a valid script, and 'yarn deploy' is for deployments, not local development.
How do you generate an optimized, production-ready version of your React app?
Explanation: 'npm run build' creates a minified, optimized build suitable for deployment. 'npm test' runs tests, 'npm install production' is invalid, and 'npx serve' starts a static server but does not build the app.