You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that the useTheme method of morfeo can result ambiguous in a react environment, for example:
const{ useTheme }=morfeo;// Can be confused with the hook `useTheme` of `@morfeo/hook`useTheme('dark');
Also other problems can occur, for example:
const{ useTheme }=morfeo;if(condition){// this is completely legal, since `useTheme` is not a hook (in this case) so we are not calling// an hook conditionally. // but the linter will complain since it will not understand that useTheme is not a hook.useTheme('dark');}
Solution
Instead of useTheme we can rename this method setCurrent, for me it makes sense even because we have a similar method called getCurrent that retrieves the name of the current theme:
const{ setCurrent }=morfeo;// No ambiguity with `useTheme`setCurrent('dark');
Also. since all the other methods related to the theme contains the suffix theme, we can this about rename not only useTheme but also getCurrent in this way:
morfeo.useTheme will become morfeo.setCurrentTheme
morfeo.getCurrent will become morfeo.getCurrentTheme
The text was updated successfully, but these errors were encountered:
The problem
I think that the
useTheme
method ofmorfeo
can result ambiguous in a react environment, for example:Also other problems can occur, for example:
Solution
Instead of
useTheme
we can rename this methodsetCurrent
, for me it makes sense even because we have a similar method calledgetCurrent
that retrieves the name of the current theme:Also. since all the other methods related to the theme contains the suffix
theme
, we can this about rename not onlyuseTheme
but alsogetCurrent
in this way:morfeo.useTheme
will becomemorfeo.setCurrentTheme
morfeo.getCurrent
will becomemorfeo.getCurrentTheme
The text was updated successfully, but these errors were encountered: