patrik-piskay / react-truncate-markup

✂️ React component for truncating JSX markup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TruncateMarkup doesn't render after the data is changed dynamically.

vainkteshkumar opened this issue · comments

TruncateMarkup doesn't render after the data is changed dynamically.
No changes is applied to data after TruncateMarkup has loaded.

<TruncateMarkup lines={3}>
              <div>
                      {Some Content}
               </div>
</TruncateMarkup>

I have the same issue with you. This is because you are using React 15, and don't support UNSAFE_componentWillReceiveProps. This function only support on React 16. You can do something like this:

ReactTruncateMarkup.prototype.componentWillReceiveProps = ReactTruncateMarkup
  .prototype.UNSAFE_componentWillReceiveProps;