
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
react-innertext
Advanced tools
Returns the innerText of a React JSX object, similar to the innerText property of DOM elements.
npm install react-innertext --save oryarn add react-innertextnpm run test oryarn testconst innerText = require('react-innertext');
innerText(
<div>
Hello <strong>world</strong>!
I am <span children={3} /> years old!
</div>
) // 'Hello world! I am 3 years old!'
import innerText from 'react-innertext';
innerText(
<div>
Hello <strong>world</strong>!
I am <span children={3} /> years old!
</div>
) // 'Hello world! I am 3 years old!'
In the below example, the title attribute of the <th> element sanitizes the children prop. This allows the children to contain HTML or other React elements, while providing a safe, plain text string for the title.
class MyTableHeaderCell extends React.PureComponent {
render() {
return (
<th
children={this.props.children}
title={innerText(this.props.children)}
/>
);
}
}
class MyTableHeader extends React.PureComponent {
render() {
return (
<thead>
<tr>
<MyTableHeaderCell>
<b>Username</b>
<SortButton />
</MyTableHeader>
</tr>
</thead>
);
}
}
FAQs
Returns the innerText of a React JSX object.
The npm package react-innertext receives a total of 543,506 weekly downloads. As such, react-innertext popularity was classified as popular.
We found that react-innertext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.