How to make PrimeReact FieldSet controllable from an other (parent) component on React?
I have a boolean object toggled
, i would like to pass it into child component.
When toggled
= true
, the FieldSet should be opened.
When toggled
= false
, the FieldSet should be closed.
import React from "react";
import { Fieldset } from "primereact/fieldset";
const FieldsetDemo = () => {
return (
<div>
<div className="card">
<h5>Toggleable</h5>
<Fieldset legend="Header" toggleable>
<p>
Lorem ipsum dolor sit amet.
</p>
</Fieldset>
</div>
</div>
);
};