pinterest-for-woocommerce icon indicating copy to clipboard operation
pinterest-for-woocommerce copied to clipboard

useBodyClasses hook is too tightly coupled to the client components.

Open ksere opened this issue 3 years ago • 1 comments

As discussed here

This useBodyClasses hook is problematic and too tightly coupled to the components.

The hook should not know anything about how/where it's used (e.g. style param and all the specific classes added/removed). A better interface would be something like:

useBodyClasses( {
   addClasses: [ 'woocommerce-onboarding', 'woocommerce-admin-full-screen' ],
   removeClasses: [ 'woocommerce-admin-is-loading' ],
} );

Though there are possibly cleaner ways to wrangle any classes / changes outside the component, where necessary.

Ideally, we should avoid components having to change the DOM outside the component where possible.

ksere avatar Apr 29 '21 17:04 ksere

Closely related to #11. Possibly easier to fix both at the same time.

haszari avatar Jun 27 '21 22:06 haszari