title: show more show less text in react
body: <p>I have various texts that each on of them has different length, and I want to display only 3 rows with show more and show less button.
  I saw examples on json but this is just a paragraph of text and I dont know how many words are in 3 lines.
  the npm show more install is not a possibilty.</p>
  
  <pre><code>export type AppState = {
      itemsToShow:number,
      expanded: Boolean
  }
  
  state: AppState = {
          itemsToShow:3,
          expanded: false
      }
  
  showMore=(ticketContent:string)=&gt; {
      this.state.itemsToShow === 3 ? (
        this.setState({ itemsToShow: ticketContent.length, expanded: true })
      ) : (
        this.setState({ itemsToShow: 3, expanded: false })
      )};
  
  &lt;div className='content'&gt;{ticket.content.toLocaleString()}&lt;/div&gt;
                  &lt;div className='content' onClick={()=&gt;this.showMore(ticket.content.toLocaleString())}&gt;
                      {this.state.expanded ? (
                   &lt;span&gt;Show less&lt;/span&gt;
                   ) : (
                    &lt;span&gt;Show more&lt;/span&gt;
                      )}
                   &lt;/div&gt;
  </code></pre>
  
  <p>I try to right something ofcourse it doesnt work and Im looking for ideas how to improve it.</p>