-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rewrite preview component to hooks #160
Conversation
isCodeShown: false, | ||
isInteractive: false, | ||
previewBackground: this.props.bgThemeColors | ||
const getBackgroundsAsArray = (previewBackgrounds, excludedColors = []) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preco sa telo tejto funkcie prepisovalo z .filter.map
na .reduce
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prislo mi rozumnejsie prechadzat pole iba raz a rovno to tam checkovat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw neviem ci to bolo spravne ale aspon to pomohlo v tom ze beni mi povedal ze konecne pochopil co ten reduce v skotocnosti robi a ako ho pouzivat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Akoze na pochopenie reducue super :) Ale teda performance zlepsenie v tejto situacii je naozaj minimalny a zanedbatelny a myslim ze .filter.map
je viac citatelne, co je sktutocny benefit v tejto situacii.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je pravda že ak niekto nepozná reduce je to menej čitateľné. ale mne príde reduce ako veľmi dobrý nástroj na zredukovanie poľa podľa nejakých podmienok. asi som ho už využíval veľa tak som si zvykol. určite je možné že pre niekoho to bude čitateľnejšie :) bol to len môj úlet asi.
const toReneder = childrenToRender || ( | ||
// eslint-disable-next-line react/no-danger | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
// TODO zjednotit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zjednotit co? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
su tu tri velmi podobne if statementy na to sme zabudli :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a co je s nimi zle? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nič :D ale opakovanie troch identických vecí hneď za sebou mi rozsvieťuje kontrolku v hlave že niečo nie je programátorsky správne :) ale kým sú za sebou tak je to aspoň prehľadné. keby boli v troch rôznych fileoch už by to bolo menej prehľadné pri refaktoringu.
second try, component in hooks not dependent on other PR