Wondering what’s next for npm?Check out our public roadmap! »

    @thorgate/spa-view
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0-beta.2 • Public • Published

    @thorgate/spa-view

    View helpers used by Thorgate project template SPA variant

    Wrap your components into Views using withView helper to take advantage of:

    • ErrorBoundary (see errors)
    • Passing user and authentication information to children
    • If not supported by the browser (or turned off), managing and restoring scroll position so that the content does not jump on loading

    view-manager has to be set up to take full advantage of features Views provide.

    Usage:

    import React from 'react';
    import { connectView } from '@thorgate/spa-view';
    
    const withView = target => (
        connectView({ onComponentError: (error) => { console.log(error); }})(target)
    );
    
    class Home extends React.Component {
        render() {
            return (
                <div className="Home">
                    <p className="Home-intro">
                        To get started, edit <code>src/App.js</code> or{' '}
                        <code>src/Home.js</code> and save to reload.
                    </p>
                </div>
            );
        }
    }
    
    export default withView(Home);

    Install

    npm i @thorgate/spa-view

    DownloadsWeekly Downloads

    866

    Version

    1.0.0-beta.2

    License

    MIT

    Unpacked Size

    20.1 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar