Reactjs

Spring Boot React Rest Api Bootstrap

This React and Spring boot tutorial will teach you how to view the records using Restful API.

All the Spring Boot Application Learn Here.

 

First we have to Install the BootStrap

npm install react-bootstrap bootstrap@5.1.3

then Add the style sheet link copy and paste  inside the head tag.i clearly explain the video tutorials below. How to add them.

After that create the Page UserList.js

UserList.js

import axios from 'axios';
import { useEffect, useState } from 'react';

function UserList() 
{
const [users, setUsers] = useState([]);
useEffect(()=>
{
  handleClick();
},[])

  async function  handleClick()
  {
     const result = await axios.get(
         "http://localhost:8013/getall");
         setUsers(result.data);
         console.log(result.data);
  }

  return (
    <div className="App">
       <h1>Employee Details</h1>
      
<table class="table table-dark" align="center">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First Name</th>
      <th scope="col">Last Name</th>
      <th scope="col">City</th>
      <th scope="col">Phone</th>
      <th scope="col">Salary</th>
    </tr>
  </thead>
       {users.map(function fn(item)
       {
            return(
            <tbody>
                <tr>
                <th scope="row">{item.id} </th>
                <td>{item.fname}</td>
                <td>{item.lname}</td>
                <td>{item.city}</td>
                <td>{item.phone}</td>
                <td>{item.salary}</td>
                </tr>
            </tbody>
            );
            })}
            </table>
                </div>
            );
        }

export default UserList;


After that call the  UserList Component inside the App.js

import UserList from "./pages/UserList";
import './App.css';
import {BrowserRouter,Switch,Route} from 'react-router-dom';

function App() {
  return (
    <div className="App">
       <BrowserRouter>
        <Switch>
          <Route path="/" exact>
          <UserList/>
             
          </Route>
      </Switch>
    </BrowserRouter>
    </div>
  );
}

i have attached the video link below. which will do this tutorials step by step.

 

admin

Recent Posts

Employee Working Hours Calculation System using C#.net

Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…

1 week ago

Java Payroll System Calculate Employee Overtime

Act as a Java developer to create a program that calculates the gross wage for…

1 week ago

Employee Working Hours Calculation System using Java

Initialize the employee number, Hourswork,and Hoursrate to calculate a grosswage use the following condition. if…

2 weeks ago

Laravel 11 School Management System

In this tutorial, we will teach you how to create a simple school management system…

2 weeks ago

How to Make Admin Panel Using React MUI

I have design the Admin Basic templete using React MUI Design Admin Dashboard and Login.Here…

4 weeks ago

Install Laravel Breeze for Authentication Using Laravel 11

In this tutorial ,i am to going teach the Laravel Breeze.Laravel Breeze provides a simple…

1 month ago