Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

195
Vistas
React Application Same instances of single JS File

So i'am new to ReactJs and web overall. I have a code in which a user will login and will be redirected to menu page. Now if police department logs into the website, he will be redirected menu page with a text saying Police department. If fire department log's in, he will be redirected to the same menu page but now the text will say Fire department. Now i can open two instances of a react app by writing npm start on another terminal on VS Code. but i want the two instances to run seperately. On one tab, police department is logged in, text says police department, in second tab when i log in fire department, the text says Fire department, but when i go back to the first tab, the police department text changes to Fire department as well. i can't find a proper solution on internet. Does anyone know someway to open separate instances of same react app. the code for menu page is:

(Type variable is the main text which shows the type of user logged in, we are getting this from python. i can make a list on python to return the right username depending on the user, python is not an issue, i can make it work, but if i can create seperate instances on web, i can make it work)

import React,{useState,useEffect} from 'react'
import {Link} from 'react-router-dom'
import './LoginSt.css'
import NavB from './Nav';
import { useHistory } from "react-router-dom"

import {storage} from './Connection'
import { TableCell, TableRow } from 'semantic-ui-react';

const Hello = () => {
    useEffect(() => {
        fetchType()
      }, []);
      
    const [Type, setType] = useState(' ');
    let history = useHistory()

function handleclick(){
    //fetch('http://127.0.0.1:5000/live')
    history.push("/VideoStreaming")
}
function fetches(){
    fetch("http://localhost:5000/getEmployeeList")
    }
function fetchType(){
    fetch('http://127.0.0.1:5000/getType').then(res => res.json()).then(data => {
        setType(data.type);
        console.log(data.type);
        });
    }

    return (
        <div>
            <NavB />
            <div className="cunt back">
                
                <h2 className="whitecol heading">{Type}</h2>
                <button className="butt2" onClick={handleclick}>See Live Stream</button>
                <Link to="/oldVids">
                <button className="butt3" onClick={fetches}>See Old Records</button>
                </Link>
                
                
            </div>    
        </div>
        
    )
}

export default Hello;
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda