Techiio-author
Started by Swarnalata RoydebApr 14, 2022

Open
Have encountered problems with the Link component.

1 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 1 VIEWES SHARE

I have read the next-routes guide (https://github.com/fridays/next-routes) .When I change the page I see a white screen and the browser reloads the whole page.// server.js

const next = require('next')

const routes = require('./routes')

const app = next({ dev: process.env.NODE_ENV !== 'production' })

const handler = routes.getRequestHandler(app)

const { createServer } = require('http')

app.prepare().then(() => {

createServer(handler).listen(3000)

})

// routes.js

const routes = require('next-routes')

module.exports = routes()

.add('/', 'index')

.add('example', 'example')

.add('/house', 'home')

//test1

<Link href="/example"><a>/example</a></Link>

<Link href="/"><a>homepage</a></Link>

//test2

<Link href="/house"><a>/house - home.js -- white screen</a></Link>Test1 works, test2 doesn't work.

I created /house with the home.js file because I want the multilingual site. So in the future /en/house and /es/oficina running home.js. Also /home must not exist.

I have tried both import { Link } from '../routes' and import Link from 'next/link'.

can someone help me please to solve this problem:(

0 Replies

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance