Material-ui: [withWidth] Provide a hook API

Created on 14 Nov 2018  路  10Comments  路  Source: mui-org/material-ui

Regarding the Hidden documentation about breakpoints, specifically this code example:

Would it be possible to get a version of this code example using React Hooks instead of recompose/compose? Recompose is being deprecated (basically) with the addition of hooks.

enhancement good first issue important

Most helpful comment

@Kizmar Hooks aren't stable yet, they are implemented on an alpha version of React. I think that we can expose a hook API version of our withWidth HOC with an explicit unstable_ prefix.

All 10 comments

@Kizmar Hooks aren't stable yet, they are implemented on an alpha version of React. I think that we can expose a hook API version of our withWidth HOC with an explicit unstable_ prefix.

@issuehuntfest has funded $40.00 to this issue. See it on IssueHunt

@oliviertassinari what package would unstable_useWidth be in? I'm unsure where to get the theme breakpoints from

@joshwooding The @material-ui/core package sounds like a nice target. As long as it's labeled unstable, people can expect breaking changes.

@oliviertassinari How would you get the breakpoints from the theme with the old context?

@joshwooding Using @material-ui/styles/ThemeProvider.

@oliviertassinari Is it okay to add that dependency across packages?

We will kill the @material-ui/core/styles module with v4 for @material-ui/styles. We can add the package as a dependency.

@joshwooding has submitted a pull request. See it on IssueHunt

@oliviertassinari has rewarded $36.00 to @joshwooding. See it on IssueHunt

  • :moneybag: Total deposit: $40.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $4.00
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sys13 picture sys13  路  3Comments

TimoRuetten picture TimoRuetten  路  3Comments

ericraffin picture ericraffin  路  3Comments

pola88 picture pola88  路  3Comments

ryanflorence picture ryanflorence  路  3Comments