Git Product home page Git Product logo

react-get-inner-text's Introduction

react-get-inner-text

checks-status workflow/status codecov npm bundle size npm

Returns the inner text of react elements. This package was inspired with HTMLElement.innerText and Node.textContent web APIs and react-innertext npm package.

Demo

CodeSandbox

Motivation

There is no native API in React to get the nested text content of react elements. This package provides a simple API to get the text content of nested elements (components)

Getting started

To use this package, you only need to install this dependency, import it and invoke the getInnerText function, e.g.:

const innerText = getInnerText(
  <div>
    <p>First paragraph.</p>
    <p>Second paragraph</p>
  </div>
)

console.log(innerText) // "First paragraph.Second paragraph"

Install

npm install @lukaspolak/react-get-inner-text

or

yarn add @lukaspolak/react-get-inner-text

Contributing

Please read the Contribution guidelines to start with your awesome contributions!

Why the library is prefixed with @lukaspolak/

There are a lot of similar libraries/packages on GitHub and npm, that can do the same. I wanted to enhance my programming skills, and I didn't want to find a unique name for the package.

react-get-inner-text's People

Contributors

lukaspolak avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.