Socket
Socket
Sign inDemoInstall

@microsoft/fast-breakpoint-tracker-react

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/fast-breakpoint-tracker-react

React component for managing breakpoints


Version published
Weekly downloads
3
Maintainers
5
Weekly downloads
 
Created
Source

FAST Breakpoint tracker React

A library for managing viewport breakpoints. Given a set of breakpoints, this component will monitor the width of the browser window and track the current active breakpoint.

Installation

npm i --save @microsoft/fast-breakpoint-tracker-react

Breakpoints

Breakpoints are expected as an array. Six default breakpoint values are provided for convenience:

const defaultBreakpoints = [0, 540, 768, 1084, 1400, 1779];

Setting custom breakpoint values

Custom breakpoint values are defined by setting the breakpoints value on the BreakpointTracker class with a new array of number values:

// Set the public static value to your custom breakpoints
BreakpointTracker.breakpoints = [0, 800, 1024, 1559];

Usage

import React from "react";
import BreakpointTracker from "@microsoft/fast-breakpoint-tracker-react";

export interface AppProps {}

class App extends React.Component<AppProps, {}> {
    render() {
        return (
            <BreakpointTracker
                render={breakpoint => (
                    <p>The current breakpoint is {breakpoint}</p>
                )}
            />
        );
    }
}

FAQs

Package last updated on 19 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc