1.2.3 • Published 6 years ago

react-page-visibility-render-props v1.2.3

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

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

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago