RE

React

@lingui/react

React bindings for Lingui with Trans components, providers, and compile-time macros

Forms
lingui
linguijs
react
react-i18n
i18n
icu
messageformat
localization
translation
rsc
Stars
5.9k
Weekly
1.0M
Open issues
69
Bundle
~25 kB

Installation

npm install @lingui/react

Code example

import { useReact } from "@lingui/react";

export function Example() {
  const form = useReact({ defaultValues: { email: "" } });

  function onSubmit(event: React.FormEvent<HTMLFormElement>) {
    event.preventDefault();
    console.log(form);
  }

  return (
    <form onSubmit={onSubmit}>
      <input name="email" type="email" placeholder="you@example.com" />
      <button type="submit">Submit</button>
    </form>
  );
}

Pros & cons

Pros

  • Actively maintained by Tomáš Ehrlich
  • 1.0M weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Not supported in React Native
  • 69 open issues on GitHub

FAQs

Alternatives & similar libraries