How to use the @remirror/react-hooks.usePrevious function in @remirror/react-hooks

To help you get started, we’ve selected a few @remirror/react-hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / ui-dropdown / src / dropdown.tsx View on Github external
getMenuProps,
      getLabelProps,
      selectedItems,
      hoveredIndex,
    } = useMultishift({
      items,
      multiple,
      selectedItems: selectedItemsProp,
      type: Type.Select,
      onSelectedItemsChange: onSelect,
      itemToString: item => item.label,
      getItemId: item => item.id,
    });

    const { sx } = useRemirrorTheme();
    const previous = usePrevious(isOpen);
    const [bind, rect] = useMeasure();
    const [{ height, opacity, transform }, setSpring] = useSpring(() => ({
      height: 0,
      opacity: 0,
      transform: 'translate3d(20px,0,0)',
    }));
    const buttonRef = useRef(null);

    useLayoutEffect(() => {
      let newDropdownPosition = dropdownPosition;
      if (!buttonRef.current) {
        return;
      }
      const buttonRect = buttonRef.current.getBoundingClientRect();

      if (autoPositionY) {

@remirror/react-hooks

A selection of core hooks built for working within the editor.

MIT
Latest version published 2 months ago

Package Health Score

89 / 100
Full package analysis

Popular @remirror/react-hooks functions