Instructions: You are tasked with building a basic React application. Follow the steps below to complete the assignment:
Step 1: Set Up Your Development Environment
- Ensure you have Node.js and npm (or yarn) installed on your computer.
- Create a new directory for your React project.
- Use create-react-app to generate a new React application within the directory.
Step 2: Create a Simple React Component
- Inside your React project folder, navigate to the src directory.
- Create a new file called HelloWorld.js.
- In HelloWorld.js, create a functional React component called HelloWorld that renders a greeting message (e.g., "Hello, React!").
- Export the HelloWorld component so that it can be used in other parts of your application.
Step 3: Render the Component
- Open the src/index.js file.
- Import the HelloWorld component you created in the previous step.
- Replace the default content of the ReactDOM.render() method with the HelloWorld component.
- Save your changes.
Step 4: Test Your Application
- Open your terminal/command prompt.
- Navigate to your project directory.
- Start your React development server using npm start (or yarn start).
- Open your web browser and visit [URL] to see your React application running.