Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
TL;DRāāāYou can render browser specific content in React with a one-liner.
Have you ever wanted to put up a banner for all your IE users and ask them to try your site in Chrome/Firefox?
With RenderInBrowser component you can render content specific to browsers.
As promised in my post a few weeks back, Iāve ported the code from my other project, wrote thorough tests and created a standalone React library to render content only in specified browsers.
The syntax is tooĀ simple.
If you want to render something only inĀ Chrome,
<RenderInBrowser only chrome> <div> Whoa! This super duper line will be rendered only in Chrome </div></RenderInBrowser>
If you want to render something in all browsers exceptĀ IE,
<RenderInBrowser except ie> <div> Darn, this stuff doesn't work in IE :( </div></RenderInBrowser>
This library is available as an NPM package and is still in beta stage (v0.2.0) ācoz Iād like to take feedback and improve on it before publishing v1.0.0.
Hereās the link to the GitHubĀ repo.
If you find something that could be improved, pl drop a feedback note and Iād very much welcome it. If you donāt find anything that could be improved, you could still drop a Hi and Iāll Hi you backĀ :)
You are amazing! Have a good day!Ā ā”ļø
Originally published atĀ dev.to.
Render Browser Specific Content with React š was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.