fridays / next-routes

Universal dynamic routes for Next.js
MIT License
2.47k stars 230 forks source link

Full page load when clicking on a <Link> #302

Closed nikolovjd closed 1 year ago

nikolovjd commented 5 years ago

Why is clicking on a link causing a full page load?

My routes.js

const routes = require('next-routes');

module.exports = routes()
  .add('register')
  .add('index', '/')
  .add('confirm-email', '/confirm-email/:token');

server.js


app.prepare().then(() => {
  const server = express();

  server.use(cookieParser());

  // SOME POST ROUTES ADDED HERE
  });

  server.use(handler);
  server.listen(4000);
});

I'm using the Link component imported from routes.js, like this:

     <Link route="index">
         <a>Index</a>
     </Link>
alanhr commented 5 years ago

Hello @nikolovjd, Which the link do you using next/Link or next-routes/link ?

nikolovjd commented 5 years ago

@alanhr I'm using next-routes/link

@jaabiri This doesn't explain why also register does full page load.

alanhr commented 5 years ago

@nikolovjd normally I use this way .add({ name: 'home', pattern: '/', page: 'home' })

komailf67 commented 4 years ago

Why is clicking on a link causing a full page load?

My routes.js

const routes = require('next-routes');

module.exports = routes()
  .add('register')
  .add('index', '/')
  .add('confirm-email', '/confirm-email/:token');

server.js

app.prepare().then(() => {
  const server = express();

  server.use(cookieParser());

  // SOME POST ROUTES ADDED HERE
  });

  server.use(handler);
  server.listen(4000);
});

I'm using the Link component imported from routes.js, like this:

     <Link route="index">
         <a>Index</a>
     </Link>

same problem!

duveborg commented 3 years ago

Did you find a solution for this?