I was using react router dom and encountered the problem with rendering components, that is, here is my code:
<Switch>
<>
<Route path="/dashboard" exact={true}>
<Dashboard />
</Route>
<div className={classes.container}>
<div className={classes.leftSide}></div>
<div className={classes.rightSide}>
<Route path="/" exact={true}>
<PhoneNumber value={value} handlerFunc={handlePhoneNumber} />
</Route>
<Route path="/registration" exact={true}>
<Registration phoneNumber={value} />
</Route>
<Route path="/login" exact={true}>
<Login />
</Route>
</div>
</div>
</>
</Switch>
The problem is when I go to /dashboard then divs with className of leftSide and rightSide are also rendered but I wanted to ensure that the divs are rendered ONLY when I go to /, /registration and /login