React Consulting and Training by Cory House, tailored for your team. 5 Lessons From Years in React



Download 23,65 Kb.
bet5/8
Sana01.07.2021
Hajmi23,65 Kb.
#106784
1   2   3   4   5   6   7   8
Bog'liq
Lessons learned from 5 years in React

Styling


  1. Mix styling approaches.

    1. Inline styles for dynamic styles.

    2. Namespace via CSS modules.

    3. Use plain Sass for global styles.

    4. CSS in JS remains a hard sell – too many horses in the race.

  1. Use classnames to apply multiple styles

  2. Use flexbox and CSS Grid over floating styles

  3. Create abstraction over flexbox to abstract breakpoints for consistency (bootstrap gives ya this)



Reusable components


  1. 3 keys to easy reuse

  2. Consider dedicating a person/team to this. Why? Speed. Less decision fatigue. Smaller bundles. Consistency = better UX. Less code = fewer bugs.

  3. Look for repeated code – opportunity for reuse. Every reuse is a perf enhancement.

  4. DRY out your forms by combining custom hooks, context, and reusable components to create an opinionated custom approach that encapsulates your app’s business rules. These tools are the foundation.

  5. Accept both a simple string and an element. Use React.isValidElement to tell which you’re getting.

  6. Create an “as” prop to specify the top-level element.

  7. Create a reusable AppLayout using the slot pattern.

  8. Centralize alerts in AppLayout and provide function for showing the alerts via context.

  9. Gen custom docs via react-docgen

  10. Consider creating separate mobile and desktop components if they differ significantly. Lazy load the relevant size.




Download 23,65 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish