Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@remirror/react

remirror178.1kMIT3.0.2TypeScript support: included

Hooks and components for consuming remirror with your fave framework React.

readme

@remirror/react

Hooks and components for consuming remirror with your fave framework React.

npm bundle size (scoped) npm

Installation

yarn add @remirror/react # yarn
pnpm add @remirror/react # pnpm
npm install @remirror/react # npm

Usage

For in depth usage with proper code example see the docs.

Controlled Editor

import React, { useCallback } from 'react';
import { fromHtml, RemirrorEventListener } from 'remirror';
import { BoldExtension, ItalicExtension, UnderlineExtension } from 'remirror/extensions';
import { createReactManager, ReactExtensions, Remirror, useRemirror } from '@remirror/react';

type Extension = ReactExtensions<ListPreset | BoldExtension>;
const extensions = () => [new BoldExtension(), new ItalicExtension(), new UnderlineExtension()];

const MyEditor = () => {
  const { manager, state, onChange } = useRemirror<Extension>({
    extensions,
    content: '<p>This is the initial value</p>',
    stringHandler: 'html',
  });

  const [value, setValue] = useState(initialValue);

  return <Remirror manager={manager} state={state} onChange={onChange} />;
};