简体   繁体   中英

How can we use dangerouslySetInnerHTML with read-more-react - npm?

how can we set dangerouslySetInnerHTML in text field, it shows error.

  <ReadMoreReact text={yourTextHere}
            min={minimumLength}
            ideal={idealLength}
            max={maxLength}
            readMoreText={readMoreText}/>

in the "yourtexthere" i want to add dangerouslySetInnerHTML

if you are receiving htmlString then you can add read more button Without using read more react package.

Wrap up your content in a div and add maxheight and overflow property to the div.

now add show more or less button at the end handle the values from the state to update div property maxheight and overflow

Hope this help you out worked for me. Feel free to ask if you don't get it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM