React UI Library Structure, Storybook and Tests

  Рет қаралды 51,040

Jack Herrington

Jack Herrington

Күн бұрын

Пікірлер
@acidhauss7018
@acidhauss7018 2 жыл бұрын
My favorite React teacher - just when you think you've learned enough, there's always so much more to learn and improve on. Greetings from London :)
@jubalm
@jubalm 2 жыл бұрын
You are a life saver! This is just so timely as I was about to abandon the monorepo (pnpm) setup having failed to setup Storybook. Really love your style of teaching, please don't get tired creating content. Much ❤ from 🇵🇭
@MohamedElmardi123
@MohamedElmardi123 2 жыл бұрын
Awesome!
@marcoscarlomagno3065
@marcoscarlomagno3065 2 жыл бұрын
All your content is so clear and cool. Thank you for it. Im a 4 yrs exp. developer (I guess I'm just starting my career) and I see you as the person I want to be in the future. Calmed, nice and enjoying sw development. Taking care of yourself and the others. Btw, I think the first unit test is flaky tobethruty() will pass even when the array is empty
@jerryzhang7022
@jerryzhang7022 2 жыл бұрын
谢谢!
@universecode1101
@universecode1101 2 жыл бұрын
Great video, React, Storybook and Test. Honestly the work you do is amazing, and I say it as a Developer and KZbinr, from the explanations to the animations. Thanks Jack
@jherr
@jherr 2 жыл бұрын
Thank you!
@CasiMaduro
@CasiMaduro 2 жыл бұрын
@@jherr please pleeeease could you explain how do you do unit testing with module federation?
@jherr
@jherr 2 жыл бұрын
@@CasiMaduro Mocks. You mock the remote modules.
@julianklumpers
@julianklumpers 2 жыл бұрын
Good to see you are back! hope everything is fine.
@jherr
@jherr 2 жыл бұрын
It’s improving and the trend looks good. Thanks for asking.
@gabriellavoro1495
@gabriellavoro1495 2 жыл бұрын
You have a very nice way to explain things. It would have helped me a lot to have someone like yourself to teach advanced concepts in such an easy to understand way.
@foo3268
@foo3268 2 жыл бұрын
Although I didn't get hired yet, I'm finding myself more and more immerse into front end development. Your videos are absurdly useful and I feel like I can watch any of them without prior knowledge and just learn some cool shit. I even refactored stuff from older projects with some of the ideas you provide. Really innovative solutions too.
@danieldiazgiraldo8337
@danieldiazgiraldo8337 2 жыл бұрын
I am not a person who comments a lot on youtube, but there are cases in which it is impossible not to, your videos are very valuable, the way you explain is excellent and goes beyond the basics that other youtubers do, I can't wait for more FE stuff such as architecture, patterns... THANKS!
@Fuzbo_
@Fuzbo_ 2 жыл бұрын
Thanks so much! Recently found your channel and been loving your content. I know you mostly focus on React & Web dev (at least from what I’ve seen), but would love to hear your approach to putting together a cross-platform (React / React-Native) UI library. Thanks again for all the content!
@alisonhj
@alisonhj 2 жыл бұрын
Thanks a lot! I've been in love with your videos since the 1st one I watched! Keep up with the excellent work!
@jherr
@jherr 2 жыл бұрын
Thanks!
@mmmikem
@mmmikem 2 жыл бұрын
Thanks so much for putting this together Jack!!! This is incredibly valuable knowledge right here.
@Microman6502
@Microman6502 2 жыл бұрын
Thanks for the tutorial Jack, it popped up in my KZbin feed just when I needed it... spooky :)
@ElijahManor
@ElijahManor 2 жыл бұрын
Like how you use pnpm I like having all related things in their own folder as well (storybook, tests, styled-components, etc...). Ohh and I love MDX as well, yay Great video, nicely done!
@leonardmanosa8774
@leonardmanosa8774 2 жыл бұрын
from your linkedin saw this post, as always, great content 👍
@avi7278
@avi7278 2 жыл бұрын
Pro tip: you're already creating stories with the correct or example props set. Instead of importing the component directly into your tests and addingprops there again, import the story component to avoid dupe code!
@betelgeus2029
@betelgeus2029 2 жыл бұрын
Thanks Jack! You are doing wonderful!
@permanar_
@permanar_ 2 жыл бұрын
wow, pretty cool. I usually go with this structure except I'm using styled components with emotion and TypeScript support! it really is amazing.
@bythealphabet
@bythealphabet 2 жыл бұрын
NICE, the video I asked for in Discord .😁 Awesome.
@cryspypotato
@cryspypotato 2 жыл бұрын
Great intro to storybook! I feel like a lot of devs tend to over-engineer the component libraries especially in smaller teams when they are trying to build something like bootstrap og material design while all they need is just a simple set of primitives. IMHO you don't always need a full blown styleguide.
@omriterem6448
@omriterem6448 2 жыл бұрын
Brilliant work Jack! Thanks for your videos especially in these difficult times. I really appreciate the time and effort you put into making content. Hope everything is getting better at home. Take care and get well soon to your wife 🙏🙏🙏
@Soundbreakr1
@Soundbreakr1 2 жыл бұрын
I use rollup manually but story book is great too it handles a lot for you
@Chavez3d
@Chavez3d 2 жыл бұрын
awesome thanks!! 🙏 for you and yours!
@Sameer_Kumar
@Sameer_Kumar 2 жыл бұрын
Hi jack I think you can extend this amazing tutorial with a part containing proper guidance for build step as a npm package. I find there’s scarcity of quality materials on this topic. Rollup will be a good choice for you to demo with, unfortunately it’s pretty messed up especially for typescript.
@oldbig1183
@oldbig1183 11 ай бұрын
Excellent video, 非常好的视频,谢谢作者。thank you。
@jacob_dmn
@jacob_dmn 6 ай бұрын
thank you so much 🌀
@AmenAmenzo
@AmenAmenzo 2 жыл бұрын
Amazing stuff as usual
@DioArsya
@DioArsya 2 жыл бұрын
100000/100 of greatness
@hakuna_matata_hakuna
@hakuna_matata_hakuna Жыл бұрын
This approach would break things in next13 , you need multiple entry points to avoid components with hooks getting imported together ina server component
@ray-lee
@ray-lee 2 жыл бұрын
Like before watching 😁
@sergeykahnwald6640
@sergeykahnwald6640 2 жыл бұрын
Storybook is a cool package) But there are some cases when we don’t need all the power of storybook, but just a simple “test page” with all our components where we can play with its props. There is one package that works just fine for this, called storybox-react
@Stoney_Eagle
@Stoney_Eagle 2 жыл бұрын
Making it pretty is our task peeps 😂😂 Maybe you can do a video on localization with i18next, it's fairly simple to setup but I don't see anyone implementing it. I implemented it from the start and adding new translations is just adding a new key value pair to the json, I love it!
@none0n
@none0n 2 жыл бұрын
Another beautiful video as always. I noticed that you didn't test the Storybook code, is that possible or needed?
@Blue-bb9ro
@Blue-bb9ro 2 жыл бұрын
Love your videos
@carlosclaro114
@carlosclaro114 2 жыл бұрын
Great video! In your component folder structure would you have a types file in the same place?
@jherr
@jherr 2 жыл бұрын
That is one way to do it. But this video offers organization by component as opposed to by file type.
@captnoplan3926
@captnoplan3926 2 жыл бұрын
Great video! What's the link for video you mentioned at the beginning for this Movies project? Is it the 'Micro front-end - Shared State' video?
@jherr
@jherr 2 жыл бұрын
Yeah, the most recent one.
@sinilyou
@sinilyou 2 жыл бұрын
Good for me . Thx
@phuocquang2314
@phuocquang2314 2 жыл бұрын
Hi sir, thank you so much for the video, but I think it'll be great if you put the starter and the finish code on the repo I think it's now only the completed code, a little bit hard to follow step by step Sorry for my bad English Thank you very much for the video, I learned from you a lot
@somewonderfulguy
@somewonderfulguy 2 жыл бұрын
Very interesting, I noticed Cyrillic letters on your screen :)
@jherr
@jherr 2 жыл бұрын
At what time? I’m kinda curious now.
@somewonderfulguy
@somewonderfulguy 2 жыл бұрын
@@jherr 1:23. And those letters are: ж, д, б
@jherr
@jherr 2 жыл бұрын
@@somewonderfulguy oh yeah. Warp was giving me Cyrillic characters there for a bit. I think it might have been my font.
@user-ux3cp4kr6r
@user-ux3cp4kr6r 2 жыл бұрын
Jack, how are you? Thank you for the video!
@jherr
@jherr 2 жыл бұрын
I’m hanging in there. Thanks for asking! FWIW, this video was shot before all this happened.
@paulbitner9986
@paulbitner9986 2 жыл бұрын
Hi Mr. Herrington, can you please explain the concept you spoke about at 21:55? So as I understand, it's not really necessary to perform testing/create a storybook on every component you create - just do it for the "bigger" components that render out the smaller ones, like the header, hero, shopping cart, etc?
@abderrahmandouara9973
@abderrahmandouara9973 2 жыл бұрын
As of the release of React 17, there's no need to import React in react components anymore, for reference, look for: Introducing the New JSX Transform on the official react blog
@jherr
@jherr 2 жыл бұрын
If you use TS and you want to reference something like React.FC then you still need to include it.
@rand0mtv660
@rand0mtv660 2 жыл бұрын
15:20 won't this check toBeTruthy always pass since queryAllByText will always at least return an empty array, which is truthy? Might be better to do queryByText("Hello").toBeInDocument() or something like that?
@jherr
@jherr 2 жыл бұрын
Yeah, that's true. Whoops.
@abderrahmandouara9973
@abderrahmandouara9973 2 жыл бұрын
Amazing! What is the difference between pnpm and npm?
@jherr
@jherr 2 жыл бұрын
pnpm is slightly faster and has some offline caching functionality.
@Fitzpa14
@Fitzpa14 2 жыл бұрын
Just tried running npx storybook init in the packages/ui directory and it didn't blow up! Looks like that fixed that.
@igor_cojocaru
@igor_cojocaru 2 жыл бұрын
How about atomic design? How would you structure the library? Will you separate it in folders (atoms, molecules, organisms) or just keep the file structure the same and separate it visually in the Storybook with "title: 'Organisms/Card" for example? Thank you Jack!
@jherr
@jherr 2 жыл бұрын
I would have one library of the atoms, and possibly commonly used molecules. Then I would have other libraries for the un-common molecules and organisms. I'd possibly have a dedicated storybook project that would including all the stories from all the libraries.
@iriel492ki
@iriel492ki 2 жыл бұрын
If you are using a monorepo architecture with module federation, would a UI library like this also be exposed via module federation? Or would the UI library components be built/versioned and then imported as npm modules by the main application.
@jherr
@jherr 2 жыл бұрын
It wouldn't. In this particular setup there are other libraries that are shared via Module Federation so that you get both live updating and fallback on a compile-time version if the lazy loading fails.
@cristhiangutierrez7996
@cristhiangutierrez7996 2 жыл бұрын
What about the tree shaking when you build the UI? it will bring all components exported in index.ts on first JS load ?
@jherr
@jherr 2 жыл бұрын
If it's a hard npm linkage then it's up to your bundler to do final build tree shaking.
@vpetryniak
@vpetryniak 2 жыл бұрын
pnpx I deprecated, use pnpm exec instead :)
@ThEldeRS
@ThEldeRS 2 жыл бұрын
At 15:14 - testing an array to be truthy will always return true, wouldn't it? Better to do queryByText or to check the length again if you choose queryAllByText
@jherr
@jherr 2 жыл бұрын
You are correct. My bad on that one.
@John-Dennehy
@John-Dennehy 2 жыл бұрын
I notice you still use React.FC type instead of letting Typescript infer it as a JSX element. I recall there being a difference with how those types handle the children prop, but otherwise is there a benefit to explicitly typing the component? Great video though. was just about to create something similar.
@jherr
@jherr 2 жыл бұрын
React.FC or React.FunctionComponent just give you a children prop by default, which we don't use here, so we could remove that. They also set the return type which is nice because it ensures that every return path returns something valid... which is cool.
@eizen8774
@eizen8774 2 жыл бұрын
@@jherr In react@18 React.FC does not give a children prop anymore
@jherr
@jherr 2 жыл бұрын
@@eizen8774 oh, right 18 took that out.
@aakashkathait8328
@aakashkathait8328 2 жыл бұрын
Can you please make a video on fetching data in next js from express server with a db
@andrepadez
@andrepadez 2 жыл бұрын
Great! Now, how do we publish a UI Library from this to NPM? Thanks
@myway9602
@myway9602 2 жыл бұрын
Can you tell me what plugin you used to get hints when writing the code?
@carlosricardoziegler2650
@carlosricardoziegler2650 2 жыл бұрын
So nice Video :) thanks for sharing. I am usina vitest nos, if is possível can you creste a vídeo with Vitest? Thanks Jack :)
@tkroll
@tkroll 2 жыл бұрын
How about SolidJS with Storybook next?
@Foreversun33
@Foreversun33 2 жыл бұрын
Hey Jack, what Tool use you for screendrawing?
@jamelljones122
@jamelljones122 2 жыл бұрын
Do you guys prefer Jest over Testing-library?
@jessedeleon1195
@jessedeleon1195 2 жыл бұрын
Is it possible to keep storybook in its own separate package, and keep stories colocated with their respective components in other packages?
@jherr
@jherr 2 жыл бұрын
I've seen it done, yes.
@alansantos9661
@alansantos9661 Жыл бұрын
I did clone the repo and run pnpm test, but I'm getting the follow error: Test suite failed to run Jest encountered an unexpected token Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. Anyone could help me pls?
@danialakabani2771
@danialakabani2771 2 жыл бұрын
Man I wish I can be half cool as you when I work, what’s this highlighter tool you are using with a pen I would very much like to have one =D
@jherr
@jherr 2 жыл бұрын
I use ScreenBrush plus a commodity drawing tablet from Gaomon. I've tried the more well known (and expensive) brand of tablet but they install driver software that routinely crashed my Mac. Gaomon doesn't install a driver and it works great.
@danialakabani2771
@danialakabani2771 2 жыл бұрын
@@jherr many thanks sir!
@techknowledgebase4504
@techknowledgebase4504 2 жыл бұрын
Are styles if we import by import './style.css' nextjs throwing error? How you handle that?
@jherr
@jherr 2 жыл бұрын
There are a bunch of different ways to handle CSS. You could use a CSS-in-JS solution (my preferred) or you could do CSS files and then bundle the CSS and include it in dist on build and dev and then bring that into the host app via an import and let Webpack bundle it.
@techknowledgebase4504
@techknowledgebase4504 2 жыл бұрын
@@jherr Thanks. We are using CSS-in-js but some of 3rd party need to import css that's time we are put that in global.css and bundle with webpack mini extract css. Nextjs otherwise giving error. What is the best approach? your saying everything one folder all components related things
@jherr
@jherr 2 жыл бұрын
@@techknowledgebase4504 Feel free to ask this question on my Discord server discord.gg/sae4SWPAFN . Please follow the #rules before posting. It would be good to have a codesandbox or stackblitz example that demonstrates the issue so that folks can more easily help you.
@abderrahmandouara9973
@abderrahmandouara9973 2 жыл бұрын
I am having a problem when I wrap my components with React.memo, the props and component name don't get to set correctly, any ideas?
@WikiPeoples
@WikiPeoples 2 жыл бұрын
Jack, are you retired? How do you have the time to research all of these videos, produce them, etc... Seems like a lot of work on top of a day job!
@jherr
@jherr 2 жыл бұрын
I'm not retired. I just choose to use my free time to help educate folks through a KZbin channel.
@WikiPeoples
@WikiPeoples 2 жыл бұрын
@@jherr That's awesome. 👏 I often wonder if I'm just lazy or if other people have more time. I appreciate your answer as it gives me a kick to do more with my time!
@dazecm
@dazecm Жыл бұрын
I'm having gnarly problems getting Storybook working with a Next.js 13 project with pnpm or npm. It only seems to be less gnarly when using Yarn. As a web dev noob these paint-points are super annoying :/
@jherr
@jherr Жыл бұрын
I haven't looked into that. Thanks for the heads up. Storybook is fantastic and it's a bummer that NextJS isn't getting along with it.
@dazecm
@dazecm Жыл бұрын
FYI. I eventually got things working with pnpm. The solve came with the pnpm version 8.1.1 upgrade. With that version you can use the Storybook init with the command pnpm dlx sb@next init. All is well in the world 🙂
@dgcp354
@dgcp354 2 жыл бұрын
thanks for the continent, I pray for your family
@ts3798
@ts3798 2 жыл бұрын
watching this makes me feel like a complete beginner. Haha...
@claus4tw
@claus4tw 2 жыл бұрын
Why are you ignoring all these missing peer deps and why does it still work?
@julioalmeida4645
@julioalmeida4645 2 жыл бұрын
Amazing vídeo. But its an overkill in my opinion
@jherr
@jherr 2 жыл бұрын
Yeah, this is like the "industrial grade" version, but for smaller projects it is overkill.
@monuxt
@monuxt 2 жыл бұрын
Hi sir please help please give your content I have some problem please fixed it's 😔
@tamlselvan9072
@tamlselvan9072 2 жыл бұрын
This stuff is cool and how is your wife now?
@jherr
@jherr 2 жыл бұрын
She is a fighter. We are taking it day by day but the trend is good. :) Thanks for asking.
@adityatyagi4430
@adityatyagi4430 2 жыл бұрын
@@jherr All the good wishes to you and your wife! Keep fighting!
@lukmanblemka3652
@lukmanblemka3652 2 жыл бұрын
Hey jack,hope you are doing okey,how is your wife doing ?
@jherr
@jherr 2 жыл бұрын
Thanks for asking. She is improving, but this first part of the treatment is rough.
You're Doing React Hooks Wrong, Probably
20:11
Jack Herrington
Рет қаралды 64 М.
Build And Publish A React Component Library
24:02
PortEXE
Рет қаралды 108 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
React JS Component Testing with Storybook 7 Typescript
21:49
Marius Espejo
Рет қаралды 9 М.
React Unit Testing Tutorial With React Testing Library and Vitest React
19:12
Monsterlessons Academy
Рет қаралды 14 М.
Mastering React Context: Do you NEED a state manager?
37:26
Jack Herrington
Рет қаралды 101 М.
Storybook with React (Complete Tutorial)
36:45
Cosden Solutions
Рет қаралды 27 М.
Build a Component Library for React with Typescript [2021]
20:50
The Nerdy Canuck
Рет қаралды 25 М.
Mastering React Memo
26:56
Jack Herrington
Рет қаралды 138 М.
This React UI Library is GAME CHANGER!
18:13
developedbyed
Рет қаралды 537 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН