Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

107
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda