client-component

1.0.1 • Public • Published

client-component

For server side rendered React applications. A class decorator to restrict rendering to client side only.

usage

import { clientOnly } from 'client-component';
 
@clientOnly
class ComponentThatAccessesWindowThatIsNotSafeForServerRendering extends Component {
    render() {
        const currentLocation = window.location;
        return (
            <div>{currentLocation}</div>
        )
    };
}

Package Sidebar

Install

npm i client-component

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

5.51 kB

Total Files

5

Last publish

Collaborators

  • peter.lazzarino