Newbie Paintball Master

    react-detect-browser

    1.0.0 • Public • Published

    react-detect-browser

    npm

    React component to detect the browser, built with detect-browser.

    Installing

    npm install react-detect-browser --save

    Usage

    import React from 'react';
    import ReactDOM from 'react-dom';
    import DetectBrowser from 'react-detect-browser';
     
    ReactDOM.render(
      <DetectBrowser>
        {({ browser }) =>
          browser ? (
            <div>
              <h1>Browser: {browser.name}</h1>
              <p>Version: {browser.version}</p>
              <p>OS: {browser.os}</p>
            </div>
          ) : (
            <h1>Could not identity browser</h1>
          )
        }
      </DetectBrowser>,
      document.getElementById('content')
    );

    DetectBrowser is the only component. It doesn't render anything itself, it just calls the children and renders that.

    License

    MIT

    Install

    npm i react-detect-browser

    DownloadsWeekly Downloads

    102

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • insidersbyte