import React from 'react' import Router from 'next/router' import Header from '../components/Header' import Counter from '../components/Counter' import dynamic from 'next/dynamic' const DynamicComponent1 = dynamic(import('../components/hello1')) const DynamicComponent2WithCustomLoading = dynamic({ loader: () => import('../components/hello2'), loading: () =>

Loading caused by client page transition ...

}) const DynamicComponent3WithNoSSR = dynamic({ loader: () => import('../components/hello3'), loading: () =>

Loading ...

, ssr: false }) const DynamicComponent4 = dynamic({ loader: () => import('../components/hello4') }) const DynamicComponent5 = dynamic({ loader: () => import('../components/hello5') }) const DynamicBundle = dynamic({ modules: () => { const components = { Hello6: import('../components/hello6'), Hello7: import('../components/hello7') } return components }, render: (props, { Hello6, Hello7 }) => (
) }) export default class Index extends React.Component { static getInitialProps ({ query }) { return { showMore: Boolean(query.showMore) } } toggleShowMore = () => { const { showMore } = this.props if (showMore) { Router.push('/') return } Router.push('/?showMore=1') } render () { const { showMore } = this.props return (
{/* Load immediately, but in a separate bundle */} {/* Show a progress indicator while loading */} {/* Load only on the client side */} {/* This component will never be loaded */} {React.noSuchField && } {/* Load on demand */} {showMore && } {/* Load multiple components in one bundle */}

HOME PAGE is here!

) } }