Quiero cambiar el ancho del componente StyledDivGrid haciendo clic en él, pero al usar este código, cuando hago clic en este div, no sucede nada. No puedo darme cuenta de cuál es el problema. ayuda, por favor
const StyledDivGrid = styled.div` display:flex; flex-wrap: wrap; width: ${props=>props.width}; height: 120px; position: relative; background-color: lightcoral; ` function App() { let [state, setState] = useState( <StyledDivGrid width = {'120px'}></StyledDivGrid> ) setState = () => { <StyledDivGrid width = {'240px'}></StyledDivGrid>; } return ( <StyledDivGrid onClick = {() => setState()}> </StyledDivGrid> ); }const StyledDivGrid = styled.div` display:flex; flex-wrap: wrap; width: ${props=>props.width}; height: 120px; position: relative; background-color: lightcoral; ` function App() { const [width, setWidth] = useState("120px") return ( <StyledDivGrid onClick={ () => setWidth("240px")} width={width}> </StyledDivGrid> ); }No revisé el código y supongo que estás usando componentes con estilo, espero que esto sea útil