I have select component with a variable ´ulState´. When this variable is 'false', it indicates that my select is open and when is 'true', its closed. I need to change the value of this variable when a person click on an determined container but i dont know how to do it.
This is the div that when clicked, need to change my variable value (in other words, close my select.)
return(
<DivElem onClick={() => console.log("Click here")}>
<div className="container">
<Row>
<Col md={4} className="column">
<h2 className={`toBlur ${toBlur.toString()}`}>
Lorem Ipsum
</h2>
<Form
toBlur={toBlur}
setToBlur={setToBlur}
/>
</Col>
</Row>
</div>
</DivElem>
)
This is my 'Select' component inside my 'Form' component
<SelectElement>
<div className={`${props.theme ?? ''}field${!touched && props.mensagemValidacao !== undefined ? 'errorclass' : ''} ${props.disabled === true ? 'disabled' : ''}`}>
<ul className={`${noClick && 'noArrow'} select ${ulState ? 'active' : ''}`}>
{noClick === false &&
<li className="active" onClick={() => openSelect(selected)}>
{selected}
</li>
}
{noClick === true &&
<li className="active">
{selected}
</li>
}
{props.opcoes.map((key, index) =>
<li
value={props.opcoes[key]}
key={index} onClick={() => selectItem(key)}>
{key}
</li>
)}
</ul>
<input
type="hidden"
id={props.id}
{...props.register}
/>
</div>
</SelectElement>