read-more-react icon indicating copy to clipboard operation
read-more-react copied to clipboard

Text is not changing even if the props passed to it changes.

Open sahilpaudel opened this issue 4 years ago • 2 comments

{
              description && <ReadMore
                text={description}
                min={80}
                ideal={100}
                max={200}
                readMoreText="See more"
              />
  }

Even if the props value description is changing the text displayed is older once. And when I reload the page it is displaying it correctly.

sahilpaudel avatar Mar 22 '20 07:03 sahilpaudel

Hey,

You probably might not need this as it's over a year old but adding a key={description} prop to component should do the trick. You can find more information here: https://stackoverflow.com/questions/38892672/react-why-child-component-doesnt-update-when-prop-changes

DeadEnglish avatar May 17 '21 11:05 DeadEnglish

Solution: { description && <ReadMore key={description} text={description} min={80} ideal={100} max={200} readMoreText="See more" /> }

bateradt avatar Jun 17 '21 21:06 bateradt