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.

import platform from 'platform';
platform.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
import React, { useState, useEffect } from "react";
import platform from 'platform';
export default function App() {
    const [version, setVersion] = useState("");
     useEffect(() => {
        setVersion(platform.version);

	console.log(platform.version);
    }, []);
  return (
    <div className="App">
      <p>{`browser version: ${version}`}</p>
    </div>
  );
}

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

I hope it helps you, All the best 👍.