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

140
Visualizações
Formik form crashes after refreshing the page

We have an edit information page in which we're using a Formik form to edit the data in a table. The flow is click row => edit => goes to ".../edit/2' page and edits id #2).

I was previously using useFormik but heard that it was only used in some use cases, so I switched over to wrapper.

In the form component I am using Redux RTK useSelector to get the data associated to the id in params and then assign that to the initial values so the form come pre-populated with information. Something like this:

const { id } = useParams();
const rowData = useSelector(state => state.rowData.rowData.filter(data => data.id == id);
const initialValues: {
  name: rowData.name,
  description: rowData.description,
  id: id
};

However, the issues is that when I refresh the page I get a reference error because my initial value is trying to access a property that is undefined. Specifically, saying: Cannot read properties of undefined (reading 'name')

about 4 years ago · Juan Pablo Isaza
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