Tagged articles
3 articles
Page 1 of 1
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
May 8, 2024 · Frontend Development

Sharing State Between Parent and Child Components in React: useImperativeHandle vs useShareState Hook

This article examines the common React modal communication problem, compares the conventional controlled‑component callback approach with the useImperativeHandle solution, and introduces a novel pair of hooks (useShareState and useShareValue) that enable seamless state sharing between parent and child components.

Custom HooksReactfrontend
0 likes · 19 min read
Sharing State Between Parent and Child Components in React: useImperativeHandle vs useShareState Hook
KooFE Frontend Team
KooFE Frontend Team
Mar 28, 2023 · Frontend Development

Master React Refs: From DOM Access to Imperative APIs

Learn how to use React refs—including useRef, forwardRef, and useImperativeHandle—to access DOM elements, create custom imperative APIs, and build interactive forms with focus and shake effects, while understanding best practices for when to employ refs versus state or props.

ReactforwardReffrontend
0 likes · 14 min read
Master React Refs: From DOM Access to Imperative APIs