Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

108
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!