github-actions
released this
05 Jul 10:22
·
237 commits
to main
since this release
Minor Changes
-
c4170a5: PatternFly elements are now available wrapped in React components. While it was
always possible to use PatternFly elements (or any other custom elements) in
React apps, this release makes it easier to integrate them into React without
the need for cumbersome workarounds to React's poor HTML and DOM support.Before:
import { useEffect, useState, useRef } from "react"; import "@patternfly/elements/pf-switch/pf-switch.js"; function App() { const [checked, setChecked] = useState(false); const switchRef = useRef(null); useEffect(() => { switchRef.current.checked = checked; }, [switchRef.current, checked]); useEffect(() => { switchRef.current.addEventListener("change", () => setChecked(switchRef.current.checked) ); }, [switchRef.current]); return ( <> <pf-switch ref={switchRef}></pf-switch> </> ); }
After:
import { useState } from "react"; import { Switch } from "@patternfly/elements/react/pf-switch/pf-switch.js"; function App() { const [checked, setChecked] = useState(false); return ( <> <Switch checked={checked} onChange={({ target }) => setChecked(target.checked)} /> </> ); }
Patch Changes
- f4a7ae7:
<pf-accordion>
: update theexpandedIndex
DOM property on change - Updated dependencies [7055add]
- Updated dependencies [a81bcb1]
- @patternfly/[email protected]