How to use the react-router-dom.withRouter function in react-router-dom

To help you get started, we’ve selected a few react-router-dom 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 sebastian-software / edgestack / src / common / wrapAsync.js View on Github external
})
    }

    render() {
      console.log("- Async Component: render():", Boolean(View))

      return View ?  : null

      /*
        
          
         : null*/
    }
  }

  return withRouter(AsyncComponent)
}
github mingzhaogu / holler / frontend / util / route_util.jsx View on Github external
const Protected = ({ component: Component, path, loggedIn, exact }) => (
   (
    loggedIn ? (
      
    ) : (
      
    )
  )} />
);

const mapStateToProps = (state) => ({
  loggedIn: Boolean(state.session.currentUser)
});

export const AuthRoute = withRouter(connect(mapStateToProps)(Auth));
export const ProtectedRoute = withRouter(connect(mapStateToProps)(Protected));
github Edgeryders-Participio / realities / ui / src / scenes / Home / components / ResponsibilitiesContainer / components / CreateResponsibility / CreateResponsibility.js View on Github external
import ListForm from '@/components/ListForm';

const CREATE_RESPONSIBILITY = gql`
  mutation CreateResponsibility_createResponsibilityMutation($title: String!, $needId: ID!) {
    createResponsibility(title: $title, needId: $needId) {
      nodeId
      title
      realizer {
        nodeId
        name
      }
    }
  }
`;

const CreateResponsibility = withRouter(({ match, history }) => (
   {
      cache.writeData({ data: { showCreateResponsibility: false } });
      const { need } = cache.readQuery({
        query: GET_NEED_RESPONSIBILITIES,
        variables: { needId: match.params.needId },
      });
      cache.writeQuery({
        query: GET_NEED_RESPONSIBILITIES,
        variables: { needId: match.params.needId },
        data: {
          need: {
            __typename: 'Need',
            nodeId: match.params.needId,
            fulfilledBy: need.fulfilledBy
github DimiMikadze / create-social-network / frontend / src / pages / Auth / SignIn.js View on Github external
<button disabled="{loading}">Log in</button>
          
        
      )}
    
  );
};

SignIn.propTypes = {
  history: PropTypes.object.isRequired,
  refetch: PropTypes.func.isRequired,
};

export default withRouter(SignIn);
github SaroarShahan / reactadminator / src / module / dashboard / containers / DashboardContainer.js View on Github external
import styled from 'styled-components';
import VisitSummary from '../components/VisitSummary';
import LineCharts from './../../charts/components/LineCharts';

const Dashboard = () =&gt; {
  return (
    &lt;&gt;
      
      
        <title>Monthly Stats</title>
      
    
  );
};

export const DashboardContainer = withRouter(Dashboard);

const Title = styled.h2`
  color: #313435;
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: 1rem;
`;
github bradtraversy / devconnector_2.0 / client / src / components / profile-forms / EditProfile.js View on Github external
};

EditProfile.propTypes = {
  createProfile: PropTypes.func.isRequired,
  getCurrentProfile: PropTypes.func.isRequired,
  profile: PropTypes.object.isRequired
};

const mapStateToProps = state => ({
  profile: state.profile
});

export default connect(
  mapStateToProps,
  { createProfile, getCurrentProfile }
)(withRouter(EditProfile));
github tadasant / where-in-the-world / app / src / components / game / GameScreen.js View on Github external
Where in the world is the photo?
        
          
          
        
        
      
    );
  }
}

GameScreen.propTypes = {
  game: PropTypes.object
};

export default withRouter(GameScreen);
github elastic / kibana / x-pack / plugins / code / public / components / main / directory.tsx View on Github external
{nodes}
        
      
    
  );
};

interface Props extends RouteComponentProps {
  node?: FileTree;
  loading: boolean;
}

export const Directory = withRouter((props: Props) =&gt; {
  let files: FileTree[] = [];
  let folders: FileTree[] = [];
  if (props.node &amp;&amp; props.node.children) {
    files = props.node.children.filter(
      n =&gt; n.type === FileTreeItemType.File || n.type === FileTreeItemType.Link
    );
    folders = props.node.children.filter(
      n =&gt; n.type === FileTreeItemType.Directory || n.type === FileTreeItemType.Submodule
    );
  }
  const { resource, org, repo, revision } = props.match.params;
  const getUrl = (pathType: PathTypes) =&gt; (path: string) =&gt;
    `/${resource}/${org}/${repo}/${pathType}/${encodeRevisionString(revision)}/${path}`;
  const fileList = ;
  const folderList = (
github calluswhatyouwant / musicritic / src / components / app / Navbar.js View on Github external
text: string,
    href: string,
    brand?: boolean,
};

const NavbarLink = ({ text, href, brand }: NavbarLinkProps) =&gt; (
    
        {text}
    
);

NavbarLink.defaultProps = {
    brand: false,
};

export default withRouter(Navbar);