How to use the next/router.withRouter function in next

To help you get started, we’ve selected a few next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morajabi / morajabi.im / components / blog / Post / Layout.js View on Github external
<div style="{{">
            <small>
              
                <a>See my other posts →</a>
              
            </small>
          </div>
        
      
    
  )
}

export default withRouter(Layout)

// Styles
const Wrapper = styled.div`
  --heading-font: 'IBM Plex Sans', 'IBM Plex Serif', -apple-system,
    BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    'Open Sans', 'Helvetica Neue', sans-serif;

  font-size: 20px;
  line-height: 1.62;
  letter-spacing: -0.007em;
  color: #333;

  word-break: break-word;
  word-wrap: break-word;

  margin-bottom: 160px;
github etalab / adresse.data.gouv.fr / components / explorer / commune / voies / voies-table / table-body.js View on Github external
}

TableBody.propTypes = {
  voies: PropTypes.array.isRequired,
  wrapped: PropTypes.bool,
  router: PropTypes.shape({
    push: PropTypes.func.isRequired,
    query: PropTypes.object.isRequired
  }).isRequired
}

TableBody.defaultProps = {
  wrapped: false
}

export default (withRouter(TableBody))
github async-labs / saas / book / 10-begin / app / components / common / MenuWithLinks.tsx View on Github external
)}
        
      
    );
  }

  public handleClick = event =&gt; {
    this.setState({ anchorEl: event.currentTarget });
  };

  public handleClose = () =&gt; {
    this.setState({ anchorEl: null });
  };
}

export default withRouter(MenuWithLinks);
github async-library / react-async / examples / with-nextjs / pages / examples / with-nextjs.js View on Github external
)}
                <p></p>
              
            )}
          
          <i>
            This data is initially loaded server-side, then client-side when navigating prev/next.
          </i>
        
      
    )
  }
}

export default withRouter(Hello)
github opencollective / opencollective-frontend / pages / discover.js View on Github external
)}
              
            
          )}
        
      )}
    
  );
};

DiscoverPage.propTypes = {
  router: PropTypes.object,
  intl: PropTypes.object,
};

export default withRouter(injectIntl(DiscoverPage));
github byte-fe / react-model / example / pages / _app.tsx View on Github external
)
}

MyApp.getInitialProps = async (context: NextAppContext) =&gt; {
  if (!(process as any).browser) {
    const initialModels = await getInitialState()
    return { initialModels }
  } else {
    return { initialModel }
  }
}

export default withRouter(MyApp)
github BanditDev / pepega / components / TopUserBlock / UserBlock.tsx View on Github external
changeURLParams({ remove: ['profile'] })} /&gt;
        
      
    );
  }
}

export default withRouter(UserBlockWithoutRouter);
github rolling-scopes / rsschool-app / client / src / pages / private-feedback.tsx View on Github external
await this.userService.submitPrivateFeedback({
          toUserId: values.userId,
          comment: values.comment,
        });
        this.props.form.resetFields();
        message.success('Your feedback has been submitted.');
        this.setState({ isLoading: false });
      } catch (e) {
        message.success('An error occured. Please try later.');
        this.setState({ isLoading: false });
      }
    });
  };
}

export default withRouter(withSession(Form.create({ name: 'privateFeadback' })(PrivateFeedbackPage)));
github chibicode / Y-Combinator-for-Non-programmers / src / components / GlobalContextProvider.tsx View on Github external
}
    return () =&gt; {
      if (router) {
        router.events.off('routeChangeComplete', handleRouteChange)
      }
    }
  })
  const handleRouteChange = () =&gt; setInitialRender(false)
  return (
    
      {children}
    
  )
}

export default withRouter(GlobalContextProvider)
github seawind8888 / Nobibi / pages / _app.js View on Github external
`}
          
        
        
          
            
              
            
          
        
      
    );
  }
}

export default withRedux(createStore)(withReduxSaga({ async: true })(withRouter(NextApp)));