question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Table] Extended `labelRowsPerPage` support from string to ReactNode

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Here you allow to use labelRowsPerPage as React.Node https://github.com/mui-org/material-ui/blob/27471b4564eb40ff769352d73a29938d25804e45/packages/material-ui/src/TablePagination/TablePagination.d.ts#L23

Here you use it as a string https://github.com/mui-org/material-ui/blob/c253b2813822239672b7a2a589324e5e00b97820/packages/material-ui/src/TablePagination/TablePagination.js#L125

So this is vaild but will generate en error “Warning: Failed prop type: Invalid prop aria-label of type object supplied to ForwardRef(SelectInput), expected string.”

<TablePagination
  labelRowsPerPage={<b>I will warn</b>}

Expected Behavior 🤔

I still want to pass a React.Node without a warning

Your Environment 🌎

Tech Version
Material-UI v4.9.9
React 16.13.1
Browser *
TypeScript 3.8.3
etc.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexAndriyanenkocommented, May 26, 2020

Is this still open, can i work on this issue?

1reaction
eps1loncommented, Apr 22, 2020

Sure. That’s why I’m generally in favor. react-intl has useIntl().formatMessage for usage in attributes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Table] Extended `labelRowsPerPage` support from string to ...
I'm using material-ui with typescript a lot and there are props that requires only string. The other props requires ReactNode. In my opinion ......
Read more >
How to modify the default value of a Material UI prop-function ...
I'm working with React JS and I've imported from Material UI a component called (https://material-ui.com/api/table-pagination/) and I would ...
Read more >
material-ui/core/CHANGELOG.md - UNPKG
306, - [Table] Add React node support to TablePagination.labelRowsPerPage (#21226) @oliviertassinari. 307, - [TextField] Fix missing autofill events ...
Read more >
Fragments - React
Take this example React snippet: class Table extends React.Component { render() { return ( <table> <tr> <Columns /> </tr> </table> ); } }....
Read more >
React with TypeScript Cheatsheet - Bits and Pieces
I hope this section has helped you to understand the different types that can be used for typing React components. How to type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found