I want to display data from a .txt file that's uploaded on an URL, on my React app. The URL is part of a JSON object that I'm "fetching" in a function using Fetch. I'm storing that Object into my state. So if I want to display the URL, I would do something like :
{this.state.result.URL}
Now I'd like to display the contents that are stored in this URL along with my other data. I've tried using tag for this. Something like this:
<p>
<object width="910" height="180" type="text/plain" data=
{this.state.result.Introduction} border="0"
style={Objectstyle}></object>
</p>
The problem I'm facing with this is that the text that appears on my screen is inside a box that has a scroll bar. If I play around with the height and width, I'm able to remove the box and the scroll bar, but the font is a very .txt style font. It looks very different from the rest of the page.
My question is how do I make that font look as same as the default font of my app. Or is there a better way to load this text from the URL? Like storing it into a variable and then just displaying the text using that variable? Thanks in advance!
EDIT: Please check these images to see the difference in the fonts and the scrollbar.
您是否以px为单位固定高度,请尝试将height = 100%设置为有效
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.