RE

React Innertext

react-innertext

Returns the innerText of a React JSX object.

Utilities
innerText
jsx
react
reactjs
react-innertext
Utilities
javascript
npm
frontend
open source
Stars
50
Weekly
1.4M
Open issues
2
Bundle
~25 kB

Installation

npm install react-innertext

Code example

import { useInnertext } from "react-innertext";

export function Example() {
  const value = useInnertext();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by Charles Stover
  • 1.4M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 2 open issues on GitHub

FAQs

Alternatives & similar libraries