React-table: column.getSortByToggleProps is not a function

Created on 28 Aug 2019  Â·  8Comments  Â·  Source: tannerlinsley/react-table

Using v6? No

Using v7? Yes

Describe the bug
When trying to use the return value of column.getSortByToggleProps as an argument to column.getHeadProps(), a Type error occurs stating that column.getSortByToggleProps is not a function

Expected behavior
The function should be a property of column, since it is being used in some of the examples.

Screenshots
Screen Shot 2019-08-27 at 7 23 59 PM

Desktop (please complete the following information):

  • OS: Mac
  • Browser: Chrome
  • Version: 10.14.5

Most helpful comment

Hey Tanner, I figured out the issue. I wasn't included the useSortBy inside of the useTable hook.

All 8 comments

@tannerlinsley - I would love to understand what the issue is.

Hmm. I can't reproduce this error. Can you please send me a codesandbox as an example?

Unfortunately I cannot. The code is proprietary and to take a small chunk out wouldn’t work because the code relies on other things in our repo.

On Aug 28, 2019, at 11:52 AM, Tanner Linsley notifications@github.com wrote:

Hmm. I can't reproduce this error. Can you please send me a codesandbox as an example?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

I would focus then on not using any of your code and just tweaking one of the examples in codesandbox to demonstrate the bug. If I can't reproduce it, then I don't know how to fix it.

Closing this for triage. Please reopen a new issue if/when you have more information on how to replicate the problem.

Thanks!

Hey Tanner, I figured out the issue. I wasn't included the useSortBy inside of the useTable hook.

I know this is old, however I am getting the exact same error and I have actually included the useSortBy inside of the useTable hook.

I get "Property 'getSortByToggleProps' does not exist on type 'HeaderGroup'"

This prop remains hidden even after having used the useSortBy hook. Is there a solution for this.

Screen Shot 2020-12-11 at 10 27 46 AM

I ran into the same issue but noticed that I had simply misplaced useSortBy in the useTable parameters like this

javascript useTable( { columns, data, useSortBy, // 🚨 useSortBy inside the options object will lead to "Property 'getSortByToggleProps' does not exist on type 'HeaderGroup'" } );

But it should be like this
javascript useTable( { columns, data, } useSortBy, // ✅ useSortBy placed after the options object );

Hope this helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pasichnyk picture pasichnyk  Â·  3Comments

DaveyEdwards picture DaveyEdwards  Â·  3Comments

tremby picture tremby  Â·  3Comments

ocalde picture ocalde  Â·  3Comments

dwjft picture dwjft  Â·  3Comments