Giter Club home page Giter Club logo

short-lnk-meteor-course's People

Contributors

andrewjmead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

short-lnk-meteor-course's Issues

How to use push in react router v4

I'm following react-meteor And I'm stuck with "push()" method , Actually I'm using react-router v4 and everything is changed and when I tried to push its faild

here is my complete code

 import {Meteor} from 'meteor/meteor';
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route} from 'react-router-dom';
import PropTypes from 'prop-types';
import {Tracker} from 'meteor/tracker';
import createBrowserHistory from 'history/createBrowserHistory';

import SignUp from '../imports/ui/SignUp';
import Link from '../imports/ui/Link';
import NotFound from '../imports/ui/NotFound';
import Login from '../imports/ui/Login';

const history = createBrowserHistory();


const unauthenticatedPages = ['/','signup'];
const authenticatedPages   = ['/link'];
const routes = (
    <Router >
        <div>
          <Route exact path="/" component={Login}/>
          <Route path="/signup" component={SignUp}/>
          <Route path="/link" component={Link}/>
          {/* <Route exact path="/notfound" component={NotFound}/> */}
        </div>
    </Router>
);

Tracker.autorun(() => {
  const isAuthenticated        = !!Meteor.userId();
  const pathname               = history.location.pathname;
  const isUnauthenticatedPages = unauthenticatedPages.includes(pathname);
  const isAuthenticatedPages   = authenticatedPages.includes(pathname);

  if (isUnauthenticatedPages && isAuthenticated) {
    // this.context.history.push('/link')
  }else if (isAuthenticatedPages && !isAuthenticated ) {
    // this.context.history.push('/')
  }
 console.log('Authenticated',isAuthenticated, pathname);
}) ;
Meteor.startup(() => {
  ReactDOM.render(routes, document.getElementById('app'));
});

errrors
erro

package json
{
  "name": "short-link",
  "private": true,
  "scripts": {
    "start": "meteor run"
  },
  "dependencies": {
    "babel-runtime": "^6.20.0",
    "meteor-node-stubs": "~0.2.4",
   "history": "^4.7.2",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-history": "^0.18.2",
    "react-router-dom": "^4.2.2"
  }
}

please help its I'm really stuck with this problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.