Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-page-visibility-render-props

antoniocapelo11MIT1.2.3

Simple react wrapper for the pagevisibility.js package, using render props for better composability

readme

react-page-visibility-render-props

Simple react wrapper for the pagevisibility.js package, using render props for better composability.

NPM JavaScript Style Guide

TODO: Complete the readme.

Install

npm install --save react-page-visibility-render-props

Usage

Just pass a function as a child of the <PageVisibility> component. This function should have a single parameter, which can be visible | hidden | prerender (check here for full description).

import React, { Component } from 'react'

import PageVisibility from 'react-page-visibility-render-props'

class Example extends Component {
  render () {
    return (
        <PageVisibility>
            {(pageVisibilityState) => {
                return (
                    <div>Page is { pageVisibilityState } so will act accordingly</div>
                )
            }}
        </PageVisibility>
    )
  }
}

License

MIT © António Capelo

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.2.3 (2018-06-29)

Bug Fixes

  • fix potential security vulnerabilities in dependencies (d361768)

1.2.2 (2018-02-15)

1.2.1 (2018-02-14)

1.2.0 (2018-02-14)

Features