z-index Tip: When creating a reusable component that declares a z-index, add this style to the root element:
isolation: isolate
Why? This creates a “stacking context”, which means your z-index won’t “leak out” and override surrounding components.
Splitting up a large front-end dev team requires 3 key ingredients:
✅ A design system
✅ Designers that use the design system as their guide
✅ A component library that implements the design system.
With these 3 keys, separate teams can deliver a single, cohesive UI.
When creating reusable React components, prefer compound components over config objects.
Compound components are more flexible and offer a more natural API.
Use React's context to pass props down to child elements as needed. 😎
#react
"react-hooks/exhaustive-deps" forces us to add dependencies in on load effect, i.e. when I want to specify list blank for one time on load execution.
This is not only a counter case of using effects but confusing!!!
Hope this will become implicit soon 😉
#reactjs#React
Storybook 6.2 introduces pluggable builders, opening the door to next-generation bundlers.
While still in its early stages, we are exploring Snowpack, ESBuild, Vite and more.
https://t.co/JmDyuHf65s
3. Code without review adds to tech debt, ends into a code base difficult to maintain over time, reduced scalability and resiliency.
4. Hard to pass on legacy to new developer.
5. Slow development process, a web of patches will never leave you do something good over time
3/3
Why do we need code reviews, it takes time to deliver something. we will refactor any issues later.....
Say NO to this if you love what you are building.
Code reviews are as important as fast delivery,
1/3
#reactjs#code#CodeBestPractices
1. Code without review going in production is a hot-fix waiting for you in the weekend.
2. More defects, waste of company resources, time and unhappy users
2/3
How much percentage of my total unit tests should be snapshot testing in React application.
Reply with 2 pros-cons of snapshot testing.
#reactj#jest#react
- Whether to include src/tests is up to the author, make sure you don't oversize your users
#npm#javascript#web
Finally, waiting for the tink project completion which will make our life easier https://t.co/6e0rj9nrnQ
Publishing npm Packages...
- 2 sides of fence, choose to include or exclude files to publish
- Excluding files: Make sure you don't publish large set of unnecessary files accidentally
- Including files: Make sure you don't miss required file and publish broken package
TIL you can declare a local file as an npm dependency. Useful for sharing code in monorepos! You don't have to actually publish the package to npm.
Example: This references myLib/index.js:
"dependencies": {
"myLib": "file:../myLib"
}
More: https://t.co/3Fx5qX4HrB
#npm