react
react copied to clipboard
fix(ButtonBase): memoize sx prop
Closes https://github.com/github/primer/issues/1191
This PR tackles some of the small wins identified by @mattcosta7 over in https://github.com/github/primer/issues/1191
Specifically, it focuses on providing stable identity for StyledButton and the two underlying Box components in ButtonBase by:
- Pull out
iconWrapStylesas a constant - Pull out
trailingIconStylesas a constant - Create a default value for the
sxprop, this allows it to be passed intosxStyleswithout triggering a new object each render
🦋 Changeset detected
Latest commit: fa5a770d9ea7562fb631394b9f8ddab8d014947b
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @primer/react | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
size-limit report 📦
| Path | Size |
|---|---|
| dist/browser.esm.js | 77.21 KB (+0.03% 🔺) |
| dist/browser.umd.js | 77.85 KB (+0.05% 🔺) |