Welcome to the Git & React Workshop! This README will guide you through the essential steps for using Git and starting a React.js project. Follow along to set up your environment, manage your code, and build your first React app.
- Git Basics
- GitHub Overview
- Git Setup
- Working with Git
- Branching in Git
- React.js Introduction
- Node.js Check
- Setting Up a React Project
- React Concepts
- Feedback
Git is a version control system that tracks and manages changes to files over time.
It uses repositories to store your project files and their entire change history, making collaboration easy.
GitHub is a web-based platform for hosting your Git repositories.
It allows you to store code online, collaborate, track issues, and showcase your projects.
-
Install Git
Download from git-scm.com. -
Configure your user info
git config --global user.name "Your Name"
git config --global user.email "your.email@eg.com"
git config --global color.ui auto- Initialize a repository
git init- Clone a repository
git clone https://github.com/YOUR_USERNAME/repo.git- Stage, commit, and push changes
git add sayhello.txt
git commit -m "Initial Commit"
git push- Check status and history
git status
git log- List branches
git branch- Create a new branch
git branch <branch-name>- Switch branches
git checkout <branch-name>- Push a branch to remote
git push --set-upstream origin <branch-name>- Merge branches
git merge <feature-branch-name>React.js is a JavaScript library for building dynamic user interfaces using reusable components, state, and props.
- Fast & efficient
- Reusable code
- Easier interactivity
Before starting with React, make sure you have Node.js installed:
node -vIf not installed, download from nodejs.org.
- Create a new React project using Vite
npm create vite@latest myweb --template react
cd mywebconst element = <h1>Hello, world!</h1>;function Welcome(props) {
return (
<h1>Hello, {props.name}</h1>
);
}const items = ['Apple', 'Banana'];
<ul>
{items.map(item => <li key={item}>{item}</li>)}
</ul>import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(count + 1)}>
count is {count}
</button>
);
}function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(count + 1)}>
count is {count}
</button>
);
}