The JSON data.js file
export const paintData = [
{
paint: [
{
name: "Weathered Moss N380-3",
lrv: "LRV:49 R:186 G:187 B:179",
rgb: "186, 187, 179",
url: "https://www.behr.com/consumer/ColorDetailView/N380-3",
},
{
name: "Jungle Camouflage N350-4",
lrv: "LRV:38 R:170 G:167 B:148",
rgb: "170, 167, 148",
url: "https://www.behr.com/consumer/ColorDetailView/N350-4/",
},
],
trim: [
{
name: "White 52",
lrv: "LRV:83 R:235 G:235 B:230",
rgb: "235, 235, 230",
url: "https://www.behr.com/consumer/ColorDetailView/52/",
},
{
name: "Authentic Tan N290-2",
lrv: "LRV:73 R:234 G:221 B:198",
rgb: "234, 221, 198",
url: "https://www.behr.com/consumer/ColorDetailView/N290-2/",
},
],
accent: [
{
name: "English Custard M290-5",
lrv: "LRV:51 R:226 G:182 B:108",
rgb: "226, 182, 108",
url: "https://www.behr.com/consumer/ColorDetailView/M290-5/",
},
{
name: "Summerwood S290-4",
lrv: "LRV:48 R:212 G:178 B:139",
rgb: "212, 178, 139",
url: "https://www.behr.com/consumer/ColorDetailView/S290-4/",
},
],
}
]
this is the Paint.js file
import React, { Component } from "react";
import { Container, Col, Row } from "react-bootstrap";
import "bootstrap/dist/css/bootstrap.min.css";
import { paintData } from "./data";
export default class Paint extends Component {
render() {
return (
<Container className="mb-5">
<div>
<p className="font-weight-bold">Approval Exterior Paint Color</p>
<hr className="my-4" />
<p className="font-italic">
What are the approved exterior paint colors?
</p>
<p className="text-center lead">
<strong>
No Reds, Dark Blue or Soft Boiled P270-6 for base colors.
</strong>
</p>
<p className="text-center">
Colors may appear different based on your electronic resolution and
settings. Color codes are the same as retrieved from Behr’s website.
</p>
<br />
</div>
<Row>
{paintData.map((data) => {
return (
<Col>
<div
style={{
background: `rgb(${data.paint.rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Paint</p>
<p>{data.paint.name}</p>
<p>{data.paint.lrv}</p>
<a href={data.paint.url} target="_blank">
Link
</a>
</div>
<div
style={{
background: `rgb(${data.trim.rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Trim</p>
<p>{data.trim.name}</p>
<p>{data.trim.lrv}</p>
<a href={data.trim.url} target="_blank">
Link
</a>
</div>
<div
style={{
background: `rgb(${data.accent.rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Trim</p>
<p>{data.accent.name}</p>
<p>{data.accent.lrv}</p>
<a href={data.accent.url} target="_blank">
Link
</a>
</div>
</Col>
);
})}
</Row>
</Container>
);
}
}
Image:
I am trying to map three different arrays separately, along with some sub-arrays. The top js file is my JSON file, and the bottom is my Paint.js file. I have an issue mapping out the JSON. How do I map the arrays properly to allow three different categories? The idea is to have 3 paint colors overlap each other for the HOA community. Any help would be great, and thank you in advance.
just taking your paint section
Instead of
<div
style={{
background: `rgb(${data.paint.rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Paint</p>
<p>{data.paint.name}</p>
<p>{data.paint.lrv}</p>
<a href={data.paint.url} target="_blank">
Link
</a>
</div>
Try this( I didn't test this code, but should work)
{data.paint.map((paintItem)=> {
return (
<div
style={{
background: `rgb(${paintItem.rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Paint</p>
<p>{paintItem.name}</p>
<p>{paintItem.lrv}</p>
<a href={paintItem.url} target="_blank">
Link
</a>
</div>
)
})
}
You were not seeing the data because this code <p{data.paint.name}</p> is actually trying to access data.paint which is an array.
You will need to update the other sections as well, where you use trim and accent
Also Tip: would be easier to read and manage if you separate this code into diff components.
You can only iterate over arrays, not objects.
This must be iteration part you are looking for.
{
paintData.paint.map( (paint, index) => (
<Col>
<div
style={{
background: `rgb(${paint.rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Paint</p>
<p>{paint.name}</p>
<p>{paint.lrv}</p>
<a href={paint.url} target="_blank">
Link
</a>
</div>
<div
style={{
background: `rgb(${paintData.trim[index].rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Trim</p>
<p>{paintData.trim[index].name}</p>
<p>{paintData.trim[index].lrv}</p>
<a href={paintData.trim[index].url} target="_blank">
Link
</a>
</div>
<div
style={{
background: `rgb(${paintData.accent[index].rgb})`,
paddintTop: "10px",
paddingBottom: "10px",
}}
>
<p>Trim</p>
<p>{paintData.accent[index].name}</p>
<p>{paintData.accent[index].lrv}</p>
<a href={paintData.accent[index].url} target="_blank">
Link
</a>
</div>
</Col>
))
}
Thank you everyone for your replies, I was able to solve the problems in a different route.
import React, { Component } from "react";
import { Container, Col, Row } from "react-bootstrap";
import "bootstrap/dist/css/bootstrap.min.css";
import { paintData } from "../data/paintData";
import { trimData } from "../data/trimData";
import { accentData } from "../data/accentData";
export default class Paint extends Component {
render() {
return (
<Container className="mb-5">
<div>
<p className="font-weight-bold">Approval Exterior Paint Color</p>
<hr className="my-4" />
<p className="font-italic">
What are the approved exterior paint colors?
</p>
<p className="text-center lead">
<strong>
No Reds, Dark Blue or Soft Boiled P270-6 for base colors.
</strong>
</p>
<p className="text-center">
Colors may appear different based on your electronic resolution and
settings. Color codes are the same as retrieved from Behr’s website.
</p>
<br />
</div>
<Row>
<Col>
{paintData.map((data) => {
return (
<div
style={{
background: `rgb(${data.rgb})`,
paddingTop: "10px",
paddingBottom: "10px",
}}
>
<p>Paint</p>
<p>{data.name}</p>
<p>{data.lrv}</p>
<a href={data.url} target="_blank">
Link to {data.name}
</a>
</div>
);
})}
</Col>
<Col>
{trimData.map((data) => {
return (
<div
style={{
background: `rgb(${data.rgb})`,
paddingTop: "10px",
paddingBottom: "10px",
}}
>
<p>Trim</p>
<p>{data.name}</p>
<p>{data.lrv}</p>
<a href={data.url} target="_blank">
Link to {data.name}
</a>
</div>
);
})}
</Col>
<Col>
{accentData.map((data) => {
return (
<div
style={{
background: `rgb(${data.rgb})`,
paddingTop: "10px",
paddingBottom: "10px",
}}
>
<p>Accent</p>
<p>{data.name}</p>
<p>{data.lrv}</p>
<a href={data.url} target="_blank">
Link to {data.name}
</a>
</div>
);
})}
</Col>
</Row>
</Container>
);
}
}
Everyone's posts have given me ideas on how to fix the problem that I have been facing. Thank you.
Related
I am making a product comparison page. I am trying to keep the checkbox checked after page refresh. Actually I have a products page where each product has a checkbox beneath it. When I click the checkbox, that specific product is added to local Storage + comparison page which I have made. But when I refresh the page, that product is saved but checkbox is unchecked but I want to keep checkbox checked and if checkbox is unchecked, that specific item should be removed from comparison page. How do I solve this query. I have tried several times but not able to do this?? Below is my code
function Home()
{
let history = useHistory()
const getLocalItems = () => {
let compare = localStorage.getItem('compare')
console.log(compare)
if(compare){
return JSON.parse(localStorage.getItem('compare'))
}
else{
return []
}
}
const [comparison,showcomparison] = useState(getLocalItems())
const [item,setItems] = useState()
const [show,setShow] = useState(false)
function onAdd(record){
const exist = comparison.find((x) => x.id === record.id)
if(exist){
showcomparison(comparison.map((x) => x.id === record.id ? {...exist, quantity: exist.quantity+1} : x)
);
}
else
{
showcomparison([...comparison,{...record,quantity: 1}])
}
}
useEffect(() => {
localStorage.setItem('compare',JSON.stringify(comparison))
}, [comparison])
const removeAll = () => {
showcomparison([])
}
return(
<div className="Home">
{
records.map(record => {
return(
<div className='container' key={record.id} onAdd = {onAdd}>
<div className='row'>
<div className='col-xl-3'>
<img style={{width: '100%', height: 'auto'}} src={record.img1} alt=""/><br></br>
<input type='checkbox' value={record.img1} onChange={() => onAdd(record)} style={{paddingRight: '30%'}}/>Compare
</div>
<div className='col-xl-4'>
<p style={{textAlign: 'left', fontWeight: 'bold', fontSize: '18px'}}>{record.title}</p>
<p style={{textAlign: 'left', fontWeight: 'bold', fontSize: '18px'}}>{record.title2}</p>
<p style={{textAlign: 'left', fontWeight: 'bold', fontSize: '18px'}}>{record.title3}</p>
<p style={{textAlign: 'left', fontSize: '15px'}}>MFG#: {record.MFG} | CDW#: {record.CDW}</p>
<p style={{fontWeight: '650', textAlign: 'left'}}>Laptop Type: {record.Type}</p>
<p style={{fontWeight: '650',textAlign: 'left'}}>Screen size: {record.size}</p>
<p style={{fontWeight: '650',textAlign: 'left'}}>Processor Type: {record.ptype}</p>
<p style={{fontWeight: '650',textAlign: 'left'}}>Processor Speed: {record.pspeed}</p>
<p style={{fontWeight: '650',textAlign: 'left'}}>Hard Drive Capacity: {record.capacity}</p>
</div>
<div className='col-xl-3'>
<ul>
<li style={{color: 'green', marginBottom: '1px', textAlign: 'left', fontSize: '13.5px', fontWeight: '640'}}><p>{record.Availability}</p></li>
</ul>
<p style={{fontSize: '13px', textAlign: 'left'}}>Ships today if ordered within 6 hrs 21 mins</p>
<h4 style={{textAlign: 'left', fontFamily: '"Source Serif Pro",serif', fontWeight: 'bold'}}>{record.price}</h4>
<p style={{textAlign: 'left'}}>Advertised Price</p>
<div className='input-group'>
<button type='button' onClick={handleDecrement} className='input-group-text'>-</button>
<div className="form-control text-center"> {quantity} </div>
<button type='button' onClick={handleIncrement} className='input-group-text'>+</button>
</div><br></br>
<button style={{width: '100%', background: '#150404', color: 'white', fontSize: '17.5px', fontWeight: '600', height: '18%'}}>Add to Cart</button>
</div>
</div><hr></hr>
</div>
)
})
}
You can use useRef on the input checkbox, use the following property to set it checked or unchecked.
checkRef.current.checked=false
<input type='checkbox' ref={checkRef} value={record.img1} onChange={() =>
onAdd(record)} style={{paddingRight: '30%'}}/>Compare
use the checkRef.current to change the value with useState.
I'm fairly new to react typescript. I want my video to finish and only then will the continue button be abled.
I found how to do this in javascript but for some reason it doesn't work for react typescript.
This is my code so far:
import { Link } from "react-router-dom";
import Container from 'react-bootstrap/Container';
function timeout(delay: number) {
return new Promise(res => setTimeout(res, delay));
}
export function Video() {
return (
<Container className="p-3">
<div className="alert alert-info" role="alert">
<h4 className="alert-heading"></h4>
<p style={{ textAlign: "center" }}>
<big> <b> Please watch the video </b> </big>
<br />
</p>
<iframe
title={"video"}
width={"560"}
height={"315"}
style={{
marginLeft: "auto",
marginRight: "auto",
marginBottom: "40px",
display: "block",
}}
src="https://www.youtube.com/embed/iw5lP63fUxY?autoplay=1&controls=0"
frameBorder={"0"}
allow={
"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
}
allowFullScreen
/>
<p style={{ textAlign: "center" }}>
<Link to="/A">
<button type="button" className="btn btn-info">
Continue
</button>
</Link>
</p>
</div>
</Container>
);
}
Did you try this?
https://www.npmjs.com/package/react-player
Expecially the "onBufferEnd" callback.
<ReactPlayer url='https://www.youtube.com/watch?v=ysz5S6PUM-U' onBufferEnd={()=>setCanContinue(true)} />
and the "Continue" button:
const [canContinue,setCanContinue] = useState(false)
<button type="button" {canContinue ? "" : "disabled"} className="btn btn-info">
I am trying to pass an onClick value, but it passes undefined. Works well if it is not a Card/Paper/Div but I need this "button" to be a Card/paper/div
onClick={() => this.handleChange('bostadstyp')}
onClick={ value='villa', handleChange('bostadstyp')}
render() {
const { bostadstyp } = this.props;
const { auth } = this.props;
const { value, values, handleChange, handleClick } = this.props;
const { backgroundColori } = this.props;
const backgroundColor2 = "#F09515";
const aa = "";
// const imageUrl = window.innerWidth >= "1600px" ? Banner1 : Banner2;
// {if (!auth.uid) return <Redirect to="/loggain" />;}
return (
<div>
<img
className="stars3"
src={Logo}
width="15%"
align="center"
marginBottom="10px"
/>
<img src={Logo} width="15%" align="center" marginBottom="10px" />
<div style={{ backgroundColor: "#F1F1F1", padding: "30px" }}>
<h2
style={{
marginTop: "0px",
marginLeft: "10%",
color: "#F09515",
fontFamily: "Avenir",
fontWeight: "bold"
}}
>
{" "}
Dina Preferenser{" "}
</h2>
</div>
<form
className="background123"
style={{
backgroundColor: "#fdfdfd",
marginTop: "0px",
marginBottom: "0px"
}}
>
<Card
className="row xl12 l12 m12 s12"
style={{
marginLeft: "10%",
marginRight: "10%",
padding: "30px",
backgroundColor: "#fdfdfd"
}}
>
<br />
<div className="col xl6 l6 m12 s12">
<h4
style={{
fontFamily: "Avenir",
fontWeight: "bold",
color: "#F09515"
}}
>
1. Välj din boendestyp
</h4>
<p className="texti" style={{ fontSize: "16px" }}>
Vi behöver den här uppgift då vissa avtal endast gäller för
vissa anläggningstyper.
</p>
</div>
<div className="col xl6 l6 m12 s12">
<Card
className="row cardi xl12 l12 m12 s12"
style={{ width: "270%", backgroundColor: `white` }}
value={"villa"}
onClick={handleChange("bostadstyp")}
>
<div className=" col xl7 l7 m6 s6">
<img src={villa} width="50px" />
</div>
<div className="col xl5 l5 m5 s5">
<h6
className="texti"
style={{ fontSize: 16, textAlign: "right" }}
>
Villa/radhus
</h6>
</div>
</Card>
</div>
</Card>
</form>
</div>
);
}
I expect to 'values.bostadstyp' get the value 'villa'
because you are using function in the class so you must using this.handleChange instead of handleChange
<Card onClick={() => this.handleChange('bostadstyp' )}>
....
</Card>
You need to attach the onClick() listener to a <CardActionsArea/> component which should be nested inside your <Card/> component
Something like
<Card className="row cardi xl12 l12 m12 s12" style={{ width: '270%', backgroundColor: `white` }} value={'villa'} onClick={handleChange('bostadstyp' )} >
<div className=" col xl7 l7 m6 s6">
<img src={villa} width="50px" />
</div>
<div className="col xl5 l5 m5 s5">
<h6 className="texti" style={{ fontSize: 16, textAlign: "right" }}>Villa/radhus</h6>
</div>
</Card>
Also, I suggest looking into the <CardActions/> documentation, the example here shows how its used
Can you try below code in your card element:
<Card className="row cardi xl12 l12 m12 s12"
style={{ width: '270%', backgroundColor: `white` }} value={'villa'}
onClick={(e) => {
e.preventDefault();
this.handleChange('bostadstyp');
}}>
The issue may be due to one of the below reasons:
1. handleChange() not bound with this.
2. To pass values from onClick handler you should use (e) => func('value')
3. The click is happening inside form element, its better to include event.preventDefault()
You need user arrow function:
onClick={() => { this.handleChange('bostadstyp' ) }}
<Card className="row cardi xl12 l12 m12 s12" style={{ width: '270%', backgroundColor: `white` }} value={'villa'} onClick={() => { this.handleChange('bostadstyp' ) }} >
<div className=" col xl7 l7 m6 s6">
<img src={villa} width="50px" />
</div>
<div className="col xl5 l5 m5 s5">
<h6 className="texti" style={{ fontSize: 16, textAlign: "right" }}>Villa/radhus</h6>
</div>
</Card>
UPDATE
Handle Change from parent component:
Make sure your handleChange is bound properly by explicitly binding it or using an arrow function syntax:
this.handleChange = this.handleChange.bind(this) // In component's constructor
// or
handleChange = (value, input) => {
this.setState({
[input]: value
});
};
onClick expects a function to invoke, so you need to wrap your handler into one:
<Card onClick={() => handleChange('villa', 'bostadstyp')}></Card>
the problem is that I am trying to hide and show elements based on states with conditional rendring but it would not worked .
I have set the state of element and pass the method in onmouseover and onmouse leave event first time it worked for one element when I repeat the same process for second element it would not worked.
constructor(props)
{
super(props)
this.state = {
show: false,
opticare: false
}
this.handleSwitch = this.handleSwitch.bind(this)
this.leave = this.leave.bind(this)
this.handleOpti = this.handleOpti.bind(this)
this.handleCare = this.handleCare.bind(this)
}
handleSwitch = () => {
this.setState({
show: !this.state.switch
})
}
leave = () => {
this.setState({
show: this.state.switch
})
}
handleOpti = () => {
this.setState({
opticare: !this.state.opticare
})
}
handleCare = () => {
this.setState({
opticare: this.state.opticare
})
}
render()
{
let className = 'reading-friends'
if (this.state.show) {
className = 'reading-friends visible'
} else if (!this.state.show) {
className = 'reading-friends invisible'
}
let addClass = 'opti-care'
if (this.state.opticare) {
addClass = 'opti-care visible'
} else if (!this.state.opticare) {
addClass = 'opti-care invisible'
}
return (
<div>
<div>
<div className="row ">
<div className="row ">
<div className={className} style={{ textAlign: 'center' }}>
<h1 className="heading" style={{
fontSize: '50px',
fontWeight: 'bold',
marginTop: '140px',
marginBottom: '200px',
fontFamily: 'catamaran,sans-serif'
}}>Reading Friends</h1>
<p className="parah">Reading Friends is designed to engage young children by
promoting interactive learning through games, puzzles,<br/>
and music. Appealing to children's instinctual inquisitiveness,
Reading Friends brings education to life with exciting graphics,<br/>
spirited sound and creative activities
that help them learn to read, while entertaining them through play.</p>
</div>
</div>
</div>
<div className="row d-flex justify-content-center">
<div style={{ textAlign: 'center' }} className={addClass}>
<h1 style={{
fontSize: '50px',
fontWeight: 'bold',
marginBottom: '200px',
fontFamily: 'catamaran,sans-serif'
}}>Opticare Solution</h1>
<p>OptiCare Solution is a complete mini ERP for opticians and optometrists.<br/>
We are the first to bring such an extensive solution in the field of Optometry,<br></br>
providing features that are robust and easy to use.</p>
</div>
</div>
<div className="row"></div>
</div>
<div style={{ marginTop: '270px' }} className="row ">
<div className="col-lg-3 col-sm-3 col-3 d-flex justify-content-center">
<a href="https://play.google.com/store/apps/details?id=com.planetreading.readingfriends">
<img onMouseOut={this.leave} onMouseOver={this.handleSwitch}
src="http://newstate.io/wp-content/uploads/2019/07/work-reading-friends-colored.png"
alt="" class="we-do-img we-work-img img-responsive grayscale"/>
</a>
</div>
<div className="col-lg-3 col-sm-3 col-3 d-flex justify-content-center">
<img onMouseOut={this.handleCare} onMouseOver={this.handleOpti}
src="http://newstate.io/wp-content/uploads/2019/07/work-opticare-colored.png"
alt="" class="we-do-img we-work-img img-responsive grayscale"/>
</div>
</div>
</div>
)
}
There's no need to create two separate functions for both onMouseEnter and onMouseLeave. You can use a single function for both event-listeners.
Just create two functions, one for each state-value you want to toggle. In the code below, we'll use handleSwitch and handleOpti.
See working sandbox: https://codesandbox.io/s/naughty-cookies-4mcwt
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
show: false,
opticare: false
};
}
handleSwitch = () => {
this.setState({
show: !this.state.show
});
};
handleOpti = () => {
this.setState({
opticare: !this.state.opticare
});
};
render() {
let className = "reading-friends";
if (this.state.show) {
className = "reading-friends visible";
} else if (!this.state.show) {
className = "reading-friends invisible";
}
let addClass = "opti-care";
if (this.state.opticare) {
addClass = "opti-care visible";
} else if (!this.state.opticare) {
addClass = "opti-care invisible";
}
return (
<div>
<div>
<div className="row ">
<div className="row ">
<div className={className} style={{ textAlign: "center" }}>
<h1
className="heading"
style={{
fontSize: "50px",
fontWeight: "bold",
marginTop: "140px",
marginBottom: "200px",
fontFamily: "catamaran,sans-serif"
}}
>
Reading Friends
</h1>
<p className="parah">
Reading Friends is designed to engage young children by
promoting interactive learning through games, puzzles,
<br />
and music. Appealing to children's instinctual
inquisitiveness, Reading Friends brings education to life with
exciting graphics,
<br />
spirited sound and creative activities that help them learn to
read, while entertaining them through play.
</p>
</div>
</div>
</div>
<div className="row d-flex justify-content-center">
<div style={{ textAlign: "center" }} className={addClass}>
<h1
style={{
fontSize: "50px",
fontWeight: "bold",
marginBottom: "200px",
fontFamily: "catamaran,sans-serif"
}}
>
Opticare Solution
</h1>
<p>
OptiCare Solution is a complete mini ERP for opticians and
optometrists.
<br />
We are the first to bring such an extensive solution in the
field of Optometry,
<br />
providing features that are robust and easy to use.
</p>
</div>
</div>
<div className="row" />
</div>
<div style={{ marginTop: "270px" }} className="row ">
<div className="col-lg-3 col-sm-3 col-3 d-flex justify-content-center">
<a href="https://play.google.com/store/apps/details?id=com.planetreading.readingfriends">
<img
onMouseOut={this.handleSwitch}
onMouseOver={this.handleSwitch}
src="http://newstate.io/wp-content/uploads/2019/07/work-reading-friends-colored.png"
alt=""
class="we-do-img we-work-img img-responsive grayscale"
/>
</a>
</div>
<div className="col-lg-3 col-sm-3 col-3 d-flex justify-content-center">
<img
onMouseOut={this.handleOpti}
onMouseOver={this.handleOpti}
src="http://newstate.io/wp-content/uploads/2019/07/work-opticare-colored.png"
alt=""
class="we-do-img we-work-img img-responsive grayscale"
/>
</div>
</div>
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
In your leave and handleSwitch function, you are using switch property of the state instead of show property.
Also, there is no need to use bind if you are using arrow functions.
I need to add link to my logo image.I mean when ever I click my logo image it should redirect to dashboard page.I tried to do it using anchor tag but it is not working properly
<Header className='header' style={{ position: 'fixed', width: '100%' }}>
<div className='header-logo' style={{ width: collapsed ? 80 : 200, height: 0 }}>
{collapsed &&
<a href="/dashboard">
<img src={minLogo} alt='Logo' />
</a>
}
{ !collapsed &&
<span> </span>
}
</div>
<Icon
className="trigger"
type={collapsed ? 'menu-unfold' : 'menu-fold'}
onClick={this.toggleSideBar}
/>
<div style={{ display: 'inline-block', float: 'right' }}>
<Dropdown overlay={menu} placement="bottomRight">
<Avatar icon='user' />
</Dropdown>
</div>
</Header>
Try this
import { Link } from "react-router-dom";
<Link to="/dashboard">
<img src={minLogo} alt='Logo' />
</Link>
User router Link instead of anchor:
<Link to="/dashboard">
<img src={minLogo} alt='Logo' />
</Link>