VS
[value, setValue] = useState(0);
value + 1;
это ведь плохая практика, и правильно писать так setValue(prev => prev + 1)?
Size: a a a
VS
M
KR
KR
KR
b
setValue(value +1 ) ?VS
VS
M
b
АК
VS
АК
VS
// НеправильноВ данном коде:
this.setState({
counter: this.state.counter + this.props.increment,
});
// Правильно
this.setState((state, props) => ({
counter: state.counter + props.increment
}));
[value, setValue] = useState(0);value будет всегда актуальным значением?
setValue(value + props.increment);
[value, setValue] = useState(0);
setValue((prevValue) => prevValue + props.increment);
IR
АЗ
С
N
C
<ThumbContainer>
<Thumbnail
alt={title}
onError={handleImgError}
ref={placeholderRef}
src={thumbnails?.url}
/>
</ThumbContainer>
const ThumbContainer = styled.div`
position: relative;
cursor: pointer;
width: 100%;
height: 200px;
overflow: hidden;
border-radius: 4px 4px 0 0;
`;
const Thumbnail = styled.img.attrs(() => ({ className: "thumbnail" }))`
color: white;
display: block;
width: 100%;
height: 100%;
background-color: white;
background-image: url("/images/catalog/video-placeholder.png");
background-repeat: no-repeat;
background-size: contain;
background-position: center center;
transition: transform 0.7s ease;
object-fit: cover;
`;
ГГ