Skip to content

@anywidget/react@0.2.0

Compare
Choose a tag to compare
@github-actions github-actions released this 25 Mar 14:23
· 16 commits to main since this release
29e30d7

Minor Changes

  • Use React.useSyncExternalStore for useModelState hook implementation (34f01a3)

    The React.useSyncExternalStore hook was introduced in React 18 and is designed for external sources of truth, like the anywidget model. It ensures a shared source within the component tree, and consistent behavior during concurrent rendering, avoiding subtle bugs present in useEffect-based patterns.

    This is marked as a breaking change to signal the internal shift in behavior, though in practice it should be considered an improvement. Most users should not notice any difference, aside from more consistent updates.

  • Mirror React.useState API in useModelState hook (34f01a3)

    Aligns the useModelState hook more closely with the React.useState API by allowing a callback function in the state setter.

Patch Changes

  • Add generic type parameter to useModel hook (34f01a3)