Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

438
Visualizações
The provided `as` value is incompatible with the `href` value error in next.js

I have three pages

  1. home/start which navigates to
  2. home/users/[type] which navigates to
  3. home/settings/[type].

home/start

import { useRouter } from 'next/router';
const Start = () => {
  const router = useRouter();
  return (
    <>
      <button
        onClick={() => {
          router.push('/home/users/native');
        }}
      >
        GO
      </button>
    </>
  );
};

export default Start;

home/users/[type]

import { useRouter } from 'next/router';

const User = () => {
  const router = useRouter();
  return (
    <>
      <button
        onClick={() => {
          router.push('/home/settings/subscription');
        }}
      >
        Go Again
      </button>
    </>
  );
};

export default User;

home/settings/type

const Settings = () => {
  return <div>Confirm docs</div>;
};

export default Settings;

I navigate from home/start to /home/users/native by clicking on the button, then to /home/settings/subscription.Then, I click on the back button to go back to home/users/native.Now, when I click on forward button to get to home/settings/subscription, I get the following error

Error: The provided as value (/home/settings/subscription) is incompatible with the href value (/[type]).

I am not using as anywhere.Can someone point out as to what I am doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You could use Link instead of a button with onClick.

import Link from 'next/link';
import { useRouter } from 'next/router';
const Start = () => {
  const router = useRouter();
  return (
    <>
      <Link to="/home/users/native">
        GO
      </Link>
    </>
  );
};

export default Start;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda