use-text-selection

use-text-selection

페이지에서 현재 선택된 텍스트를 반환하는 훅이에요. @mantine/hooks 패키지의 훅이에요.

출처: 문서

본문

사용법 (Usage)

use-text-selection 훅은 현재 텍스트 선택을 반환해요:

import { useTextSelection } from '@mantine/hooks';

function Demo() {
  const selection = useTextSelection();
  return (
    <>

Select some text here or anywhere on the page and it will be displayed below

Selected text: {selection?.toString()}

  );
}

정의 (Definition)

function useTextSelection(): Selection | null;

더 알아보기 (Learn more)