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>
        )
    };
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.10latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.10
1.0.00

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