Navigate back to the homepage

how to get browser version in react js?

Infinitbility
React
July 25th, 2022 · 1 min read
how to get browser version in react js?

To get the browser version in react js, install the platform package and call platform.version it will return the browser version.

Take the example of using the platform package to get the browser version in react js.

1import platform from 'platform';
2platform.version; // '10.0'

Today, I’m going to show you How do I get the browser version in react js, as above mentioned here, I’m going to use the platform package to check the browser version.

Let’s start today’s tutorial how do you get the browser version in react js?

In this example, we will do

  1. Install the platform package
  2. Use the platform.version method in function and console the output.
  3. Print browser version on screen
1import React, { useState, useEffect } from "react";
2import platform from 'platform';
3export default function App() {
4 const [version, setVersion] = useState("");
5 useEffect(() => {
6 setVersion(platform.version);
7
8 console.log(platform.version);
9 }, []);
10 return (
11 <div className="App">
12 <p>{`browser version: ${version}`}</p>
13 </div>
14 );
15}

In the above example, we are getting the browser version and printing it to the screen.

I hope it helps you, All the best 👍.

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

how to export constants in typescript?

how to export constants in typescript?

TypeScript, export constants example with the step-by-step guide.

July 24th, 2022 · 1 min read
how to extract numbers from the string in typescript?

how to extract numbers from the string in typescript?

TypeScript, export constants example with the step-by-step guide.

July 24th, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]