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

109
Visualizações
Set Default Value global-Filter React-Table

I have a React-Table and using the globalFilter of React. The filtering works with the OnChange function, but i want to set a default String to my Input-Field and trigger the filtering Function. This is my Component:

import React from "react";

export const GlobalFilter = ({ filter, setFilter }) => {
    
  return (
    <span>
      <input
        id="globalFilterOrderHistory"
        className="input searchHistoryOrder"
        placeholder="Search"
        value={filter || ""}
        onChange={(e) => setFilter(e.target.value)}
      />
      <i className="fa fa-search fa-1_5" />
    </span>
  );
};

I tried to add something like this:

useEffect(()=>{
       setFilter("projekt");
   })

The filter is now set to the String "projekt", but now I can´t type something in the InputField.

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

0

I got the answer, there should be passed a secound argument to the useEffect

useEffect(()=>{
       setFilter("projekt");
   },[])
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