React Texas
React Texas
npm is the default package manager for it will first check if the package is installed
Node.js. It allows you to install, update, locally or globally. If not found, it will
and manage packages (libraries or temporarily download the package,
modules) from the npm registry. execute the command, and then remove
the package.
1. Introduction to React
React is a popular JavaScript library for building user interfaces. Developed by Facebook, it
allows developers to create reusable UI components, manage component state, and
improve the performance of applications.
2. Creating a React App
Open the terminal (Command Prompt or Git Bash on Windows).
Install the Create React App CLI tool globally:
------------------
Asset Images Config!
-------
Connected Files:
Index.html – App.js- Index.js
Figure 1: Index.html
import {
BrowserRouter as Router,
Routes,
Route,
} from "react-router-dom";
function App() {
return (
<Router>
<Routes>
<Route path="/" element={<h1>Homepage</h1>} />
</Routes>
</Router>
);
}
Separate Pages:
→ Rafce
Separate Components
Separate page rendering,
Homepage carasoul:
.carousel{
width: 100%;
height: 50vh; /* Change the height to 50% of viewport height */
background: #000;
position: relative;
}
.carousel img {
object-fit: cover; /* Use object-fit to cover the image within the carousel */
width: 100%;
height: 50vh; /* Set the height of the image to 100% to fill the carousel */
}
Register page:
</form>
Variable to save local state:
on Click on button:
Fix the responsive
Register user:
Create Slice
Slice is the piece of redux store.
userSlice.js
import in store.
2. Wrap index.js
Install redux extension:
UseEffect and Dispatch:
</div>
<div className="modal-footer">
<button type="button" className="btn btn-
secondary">Close</button>
<button type="button" className="btn btn-
primary">Save changes</button>
</div>
</div>
</div>
</div>
);
};
export default EditUserModal;
Using value in UI
Model will be shown on homepage:
Pass the required props.
For editing/updating:
1. Make a state
2. on Change function
3. Submit function
Assign to input:
Update user API:
Deleting:
When button is clicked, Pass the ID
Searching:
1. Create a UI
User Components:
Use it in homepage:
Sorting users in table:
1. Make a sort Config!,
Result: