Getting Started with Create React App

Version

node -v (v21.0.0)
npm -v (v10.2.0)

npx create-react-app reactecom
cd reactecom
npm start

For React Router Dom

npm install react-router-dom

For Install Axios

🗏 Install Axios: Axios

npm install axios

For Bootstrap

🗏 Install Bootstrap: Bootstrap

npm install bootstrap@5.3.2

For Sweetalert

🗏 Install Sweetalert: Sweetalert

npm install sweetalert --save

Usage:

    import swal from 'sweetalert';
    swal("Hello world!");

Authenticating

CSRF Protection:To authenticate your SPA, your SPA's "login" page should first make a request to the /sanctum/csrf-cookie endpoint to initialize CSRF protection for the application:

    axios.get('/sanctum/csrf-cookie').then(response => {
      axios.post(`${constant.url}/api/register`, data).then((res) => {

      });
    });

For Admin Panel

📁 Admin Panel Download: Admin Panel

Hierarchy


📂 src
    📂 assets
        📂 admin
            📁 assets
            📁 css
            📁 javascript
        📂 frontend
    📂 components
        📂 admin
            🗏 Dashboard.js
            🗏 Profile.js
        📂 Frontend
            📂 auth
                🗏 Login.js
                🗏 Register.js
            🗏 Home.js
    📂 layouts
        📂 admin
            🗏 Footer.js
            🗏 MasterLayout.js
            🗏 Navbar.js
            🗏 Sidebar.js
        📂 frontend
            🗏 Navbar.js
    📂 routes
        🗏 Routes.js

Errors:

image

if your are facing this error, you should add in your .env file.

SESSION_DOMAIN=localhost
SANCTUM_STATEFUL_DOMAINS=localhost

Connect

🔗 You can find me on Stack Overflow: Stack Overflow Profile

🌐 Connect with me on LinkedIn: LinkedIn Profile