Answer the question
In order to leave comments, you need to log in
Why doesn't React props work?
When I put active and setActive in front, props don't work, and when I put active and setActive in the back, they don't work, but props works
export const CardNews = ({ active, setActive }, props) => {
return (
<div className="news-card">
<div className="news-card__content">
<div className="news-card__img">
<img src={image_1} alt="img" className="news-card__image" />
</div>
<div className="news-card__text">
<div className="news-card__title">{props.title}</div>
<div className="news-card__descr">{props.descr}</div>
<button className="check-news" id={props.id} onClick={() => setActive(true)}>
Читать
</button>
</div>
</div>
</div>
)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question