Home > database >  Problem with react-table GlobalFilter when typing
Problem with react-table GlobalFilter when typing

Time:08-27

the problem I'm facing with react-table and GlobalFilter is that when I type something in the input it only allows one letter at a time. When you start writing just type the first letter and then lost the focus on the input.

I have followed the documentation from react-table but is not working as expected: https://react-table-v7.tanstack.com/docs/api/useGlobalFilter

Here is the code that i've tried https://codesandbox.io/s/priceless-tharp-sllqnv?file=/src/App.js

I tried to use the autoFocus property in the input but is not what I want

Any help will be great for me, thanks in advance

CodePudding user response:

That's because you put DefaultColumnFilter inside the TablaGenericaConFiltros body. So on each render there is a new component!

Move DefaultColumnFilter (and other stuff for safety) to the top level and everything will work.

Working example

  • Related