{"_id":"react-innertext","_rev":"3891172","name":"react-innertext","description":"Returns the innerText of a React JSX object.","dist-tags":{"latest":"1.1.5"},"maintainers":[{"name":"charlesstover","email":""}],"time":{"modified":"2025-09-01T01:03:53.000Z","created":"2018-05-15T22:29:16.344Z","1.1.5":"2019-06-15T22:00:40.321Z","1.1.4":"2019-06-15T21:53:11.773Z","1.1.3":"2019-02-11T19:06:03.792Z","1.1.2":"2018-07-19T22:48:05.882Z","1.1.1":"2018-05-15T22:58:38.968Z","1.1.0":"2018-05-15T22:29:16.344Z"},"users":{},"author":{"name":"Charles Stover","url":"react-innertext@charlesstover.com"},"repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"versions":{"1.1.5":{"name":"react-innertext","version":"1.1.5","author":{"name":"Charles Stover","url":"react-innertext@charlesstover.com"},"description":"Returns the innerText of a React JSX object.","homepage":"https://github.com/CharlesStover/react-innertext#readme","license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"types":"index.d.ts","bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues","email":"react-innertext@charlesstover.com"},"directories":{"lib":"src","test":"tests"},"keywords":["innerText","jsx","react","reactjs"],"scripts":{"build":"tsc","prepublishOnly":"tsc","test":"mocha -r ts-node/register tests/index.test.tsx"},"devDependencies":{"@types/chai":"^4.1.7","@types/mocha":"^5.2.7","@types/node":"^12.0.8","@types/react":"^16.8.0","chai":"^4.1.2","mocha":"^5.2.0","react":"^16.0.0","ts-node":"^8.3.0","typescript":"^3.5.0"},"peerDependencies":{"@types/react":">=0.0.0 <=99","react":">=0.0.0 <=99"},"gitHead":"c7f3095a96d2870802a3016ae0ab0788457c341c","_id":"react-innertext@1.1.5","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"charlesstover","email":"npmjs@charlesstover.com"},"dist":{"shasum":"8147ac54db3f7067d95f49e2d2c05a720d27d8d0","size":2478,"noattachment":false,"key":"/react-innertext/-/react-innertext-1.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-innertext/download/react-innertext-1.1.5.tgz"},"maintainers":[{"name":"charlesstover","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-innertext_1.1.5_1560636040179_0.605943045728931"},"_hasShrinkwrap":false,"publish_time":1560636040321,"_cnpm_publish_time":1560636040321,"_cnpmcore_publish_time":"2021-12-17T05:37:45.944Z"},"1.1.4":{"name":"react-innertext","version":"1.1.4","author":{"name":"Charles Stover","url":"react-innertext@charlesstover.com"},"description":"Returns the innerText of a React JSX object.","homepage":"https://github.com/CharlesStover/react-innertext#readme","license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"types":"index.d.ts","bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues","email":"react-innertext@charlesstover.com"},"directories":{"lib":"src","test":"tests"},"keywords":["innerText","jsx","react","reactjs"],"scripts":{"build":"tsc","prepublishOnly":"tsc","test":"mocha -r ts-node/register tests/index.test.tsx"},"devDependencies":{"@types/chai":"^4.1.7","@types/mocha":"^5.2.7","@types/node":"^12.0.8","@types/react":"^16.8.0","chai":"^4.1.2","mocha":"^5.2.0","react":"^16.0.0","ts-node":"^8.3.0","typescript":"^3.5.0"},"peerDependencies":{"@types/react":">=0.0.0 <=99","react":">=0.0.0 <=99"},"gitHead":"8db8f089eb96d097422b48a6eb1a73d6de6f7704","_id":"react-innertext@1.1.4","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"charlesstover","email":"npmjs@charlesstover.com"},"dist":{"shasum":"31d6f279d7be5401a82572018506c2531faa834a","size":2505,"noattachment":false,"key":"/react-innertext/-/react-innertext-1.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-innertext/download/react-innertext-1.1.4.tgz"},"maintainers":[{"name":"charlesstover","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-innertext_1.1.4_1560635591602_0.8863841084103119"},"_hasShrinkwrap":false,"publish_time":1560635591773,"_cnpm_publish_time":1560635591773,"_cnpmcore_publish_time":"2021-12-17T05:37:46.214Z"},"1.1.3":{"name":"react-innertext","version":"1.1.3","author":{"name":"Charles Stover","url":"react-innertext@charlesstover.com"},"bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues","email":"react-innertext@charlesstover.com"},"description":"Returns the innerText of a React JSX object.","directories":{"lib":"src","test":"tests"},"homepage":"https://github.com/CharlesStover/react-innertext#readme","keywords":["innerText","javascript","js","jsx","react","reactjs"],"license":"MIT","main":"react-innertext.js","repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"scripts":{"build":"webpack","prepublishOnly":"webpack","test":"mocha --require @babel/register tests/react-innertext.js"},"dependencies":{},"devDependencies":{"@babel/core":"^7.0.0-beta.54","@babel/preset-env":"^7.0.0-beta.54","@babel/preset-react":"^7.0.0-beta.54","@babel/register":"^7.0.0-beta.54","babel-loader":"^8.0.0-beta.4","chai":"^4.1.2","jsdom":"^11.11.0","jsdom-global":"^3.0.2","mocha":"^5.2.0","react":"^16.0.0","webpack":"^4.16.1","webpack-cli":"^3.1.0"},"gitHead":"99c6ca71369a5e010651041e5af654288aac9c2c","_id":"react-innertext@1.1.3","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"charlesstover","email":"npmjs@charlesstover.com"},"dist":{"shasum":"5d0b85abdae0949f518830e09ee97e6dcf0680e9","size":2770,"noattachment":false,"key":"/react-innertext/-/react-innertext-1.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-innertext/download/react-innertext-1.1.3.tgz"},"maintainers":[{"name":"charlesstover","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-innertext_1.1.3_1549911963645_0.6191119169786008"},"_hasShrinkwrap":false,"publish_time":1549911963792,"_cnpm_publish_time":1549911963792,"_cnpmcore_publish_time":"2021-12-17T05:37:46.423Z"},"1.1.2":{"name":"react-innertext","version":"1.1.2","author":{"name":"Charles Stover","url":"https://charlesstover.com/"},"bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues"},"description":"Returns the innerText of a React JSX object.","devDependencies":{"@babel/core":"^7.0.0-beta.54","@babel/preset-env":"^7.0.0-beta.54","@babel/preset-react":"^7.0.0-beta.54","@babel/register":"^7.0.0-beta.54","babel-loader":"^8.0.0-beta.4","chai":"^4.1.2","jsdom":"^11.11.0","jsdom-global":"^3.0.2","mocha":"^5.2.0","react":"^16.0.0","webpack":"^4.16.1","webpack-cli":"^3.1.0"},"homepage":"https://github.com/CharlesStover/react-innertext/","keywords":["innerText","javascript","js","jsx","react","reactjs"],"license":"MIT","main":"react-innertext.js","repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"scripts":{"build":"webpack","prepublishOnly":"yarn build","test":"mocha --require @babel/register tests/react-innertext.js"},"gitHead":"42b5ac3a51d7ea38774ce43de3264e09e8cd8ba7","_id":"react-innertext@1.1.2","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"charlesstover","email":"npmjs@charlesstover.com"},"dist":{"shasum":"68abfb194845e897f5b15eb713f563a01330b0d9","size":39950,"noattachment":false,"key":"/react-innertext/-/react-innertext-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-innertext/download/react-innertext-1.1.2.tgz"},"maintainers":[{"name":"charlesstover","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-innertext_1.1.2_1532040485773_0.9309381622490753"},"_hasShrinkwrap":false,"publish_time":1532040485882,"_cnpm_publish_time":1532040485882,"_cnpmcore_publish_time":"2021-12-17T05:37:47.108Z"},"1.1.1":{"author":{"name":"Charles Stover","url":"https://charlesstover.com/"},"description":"Returns the innerText of a React JSX object.","homepage":"https://github.com/CharlesStover/react-innertext/","name":"react-innertext","repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"keywords":["innerText","javascript","js","jsx","react","reactjs"],"license":"MIT","main":"react-innertext","version":"1.1.1","bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues"},"scripts":{"test":"cd test && node es5.js"},"devDependencies":{"babel-core":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","react":"^16.2.0"},"gitHead":"154c576f28077ecddc2b71db10faaa02051b2180","_id":"react-innertext@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"charlesstover","email":"npmjs@charlesstover.com"},"dist":{"shasum":"e46d215024e38a830a43efb76bbc5b76a082bd3f","size":1745,"noattachment":false,"key":"/react-innertext/-/react-innertext-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-innertext/download/react-innertext-1.1.1.tgz"},"maintainers":[{"name":"charlesstover","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-innertext_1.1.1_1526425118884_0.7774719879781558"},"_hasShrinkwrap":false,"publish_time":1526425118968,"_cnpm_publish_time":1526425118968,"_cnpmcore_publish_time":"2021-12-17T05:37:47.315Z"},"1.1.0":{"author":{"name":"Charles Stover","url":"https://charlesstover.com/"},"description":"Returns the innerText of a React JSX object.","homepage":"https://github.com/CharlesStover/react-innertext/","name":"react-innertext","repository":{"type":"git","url":"git+https://github.com/CharlesStover/react-innertext.git"},"keywords":["innerText","javascript","js","jsx","react","reactjs"],"license":"MIT","main":"react-innertext","version":"1.1.0","bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues"},"scripts":{"test":"cd test && node es5.js"},"devDependencies":{"babel-core":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","react":"^16.2.0"},"gitHead":"91e0e35986e479af27aeafd5c051e31f69861fd0","_id":"react-innertext@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"charlesstover","email":"npmjs@charlesstover.com"},"dist":{"shasum":"3e09d823db8b7e1fa644eab7ef20095eb74cce9b","size":1694,"noattachment":false,"key":"/react-innertext/-/react-innertext-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-innertext/download/react-innertext-1.1.0.tgz"},"maintainers":[{"name":"charlesstover","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-innertext_1.1.0_1526423356267_0.2896540295825185"},"_hasShrinkwrap":false,"publish_time":1526423356344,"_cnpm_publish_time":1526423356344,"_cnpmcore_publish_time":"2021-12-17T05:37:47.550Z"}},"readme":"# React innerText [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=You%20can%20access%20the%20innerText%20of%20React%20components%20as%20if%20they%20were%20DOM%20nodes%20by%20using%20the%20react-innertext%20package.&url=https://github.com/CharlesStover/react-innertext&via=CharlesStover&hashtags=react,reactjs,javascript,webdev,webdeveloper,webdevelopment) [![version](https://img.shields.io/npm/v/react-innertext.svg)](https://www.npmjs.com/package/react-innertext) [![minzipped size](https://img.shields.io/bundlephobia/minzip/react-innertext.svg)](https://www.npmjs.com/package/react-innertext) [![downloads](https://img.shields.io/npm/dt/react-innertext.svg)](https://www.npmjs.com/package/react-innertext) [![build](https://travis-ci.com/CharlesStover/react-innertext.svg)](https://travis-ci.com/CharlesStover/react-innertext/)\n\nReturns the innerText of a React JSX object, similar to the innerText property\nof DOM elements.\n\n## Install\n\n* `npm install react-innertext` or\n* `yarn add react-innertext`\n\n## Use\n\n### Client-Side Rendering (ES6)\n\n```JS\nimport innerText from 'react-innertext';\ninnerText(\n  <div>\n    Hello <strong>world</strong>!\n    I am <span children={3} /> years old!\n  </div>\n) // 'Hello world! I am 3 years old!'\n```\n\n### Server-Side Rendering (CommonJS)\n\n```JS\nconst innerText = require('react-innertext');\ninnerText(\n  <div>\n    Hello <strong>world</strong>!\n    I am <span children={3} /> years old!\n  </div>\n) // 'Hello world! I am 3 years old!'\n```\n\n### Real World Example\n\nIn the below example, the `title` attribute of the `<th>` element sanitizes the\n`children` prop. This allows the children to contain HTML or other React\nElements, while providing a safe, plain text string for the `title`.\n\n```JS\nfunction MyTableHeader() {\n  return (\n    <thead>\n      <tr>\n        <MyTableHeaderCell>\n          <b>Username</b>\n          <SortButton />\n        </MyTableHeader>\n      </tr>\n    </thead>\n  );\n}\n\n// title=\"Username\"\nfunction MyTableHeaderCell({ children }) {\n  return (\n    <th\n      children={children}\n      title={innerText(children)}\n    />\n  );\n}\n```\n","_attachments":{},"homepage":"https://github.com/CharlesStover/react-innertext#readme","bugs":{"url":"https://github.com/CharlesStover/react-innertext/issues","email":"react-innertext@charlesstover.com"},"license":"MIT"}