RUVIDEO
Поделитесь видео 🙏

Refactor Code 100x Faster in React JS | React JS Tutorial

Process of restructuring the existing code without changing its external behavior is refactoring.
To void technical debt we have to refactor code often. I will share some of the best practices to write efficient and readable components in React JS.

Refactoring in React JS mainly involves:

- Code formatting improvements
- Removing unnecessary tags and code
- Using understandable meaningful names for variables, classes, functions, files and folders
- Avoiding repetitions
- Using functional over class components
- Avoiding arrow function in render or in JSX
- Making the bundle smaller and using code splitting
- Keeping components small
- Using pure components
- Using single responsibility functions
- Using comments
- Keeping same structure in code
- Using linter and/or prettier rules

and such

I will share a technique and useful resource that will help you in some areas of code refactoring easily in React JS.

Select the code and a light bulb appears in visual studio code. Clicking it gives me few options or actions. I can conditionally render the selected code or extract code into another component with automatic import statement and component tag creation. I can move this code into another component easily just by selecting the code. We have moved the selected code into another component. Import statement has been created for the new component. And component tag has been placed in JSX as well.

I can select a component and convert class component into function component. I can convert function component into a class component easily. I can change state variables names easily. I can select event handler function and wrap it with useCallback easily.

Selection of code determines code refactoring actions. Different selection will give you different options. And I can do a lot more by just selecting code and choosing appropriate actions.

And here is how i am doing it. Go to vs code extensions and search for 'Glean'. This extension provides refactoring tools for React codebase.

With this extension, you can:

- Extract JSX into new component in React JS
- Convert Class Components to Functional Components in React JS
- Convert Functional Components to Class Components in React JS
- Wrap JSX with conditional in React JS
- Rename state variables and their setters simultaneously in React JS
- Wrap code with useMemo, useCallback or useEffect in React JS
- Move code between files in React JS
- Break components into parent child components in React JS
- Create new component from selected code in React JS
- Convert setState calls to useState in React JS
- Convert componentDidMount and componentWillUnmount to useEffect in React JS
- Convert class properties to useRef in React JS
- Wrap call non-Lifecycle methods with useCallback in React JS

It has got Typescript support, ES2015 modules support, CommonJS modules support and more. This extension works with js, jsx, ts and tsx files. I would recommend you quickly write logic and everything in same component. Then break it into other components and refactor code further. It will save time and make you code faster and refactor faster in React JS.

Find more about reactjs, react tutorials, react js how to guides, step by step react tutorial and react js tutorial examples at WebStylePress by following us.

✅ Display Data From JSON File in React
https://youtu.be/4fCr1IepJRw
✅ Display Icons / Images from JSON File in React JS
https://youtu.be/NWG1Ygt1k1k
✅ Fetch All Types of Data from JSON File in React JS
https://youtu.be/8nkVXiGH-7I
✅ 7 Ways to use Images in React JS
https://youtu.be/U07wzhfu66M
✅ Easy Way to use Images in React JS
https://youtu.be/0EtYzQn-Scw
✅ Require Image Not Working in React JS
https://www.youtube.com/watch?v=ay6id01369s
✅ Multiple Images in One Import
https://www.youtube.com/watch?v=gEMAZSO85KY
✅ Multiple Sets of Images from One Import in React JS
https://www.youtube.com/watch?v=SpjzhwcMcbs
✅ Default Map is not a Function in React JS
https://www.youtube.com/watch?v=XMm12Dw_Kpw
✅ Async Await Fetch in React JS
https://www.youtube.com/watch?v=9fr7ytpvybY
✅ Assigned a Value but Never Used
https://youtu.be/3_4QlPxuEK4
✅ Easily Sort Before Displaying Records in React JS
https://youtu.be/zZzcnmU_LoU
✅ Responsive Image Gallery from Scratch in React JS
https://youtu.be/J1dg4WXr3cg

✅ ReactJS Playground
https://youtube.com/playlist?list=PL1w28LzkbaQEdqbLVVGuR46lriyR_Ifiy
✅ JavaScript Problem Solving:
http://bit.ly/JavsScriptProblemSolving
✅ Web Development Essentials:
http://bit.ly/WebDevEssentials
✅ Crash Courses:
http://bit.ly/WSPCrashCourses

Thank You!
? LIKE VIDEO
? SUBSCRIBE
? PRESS BELL ICON
✍️ COMMENT

Channel: https://www.youtube.com/webstylepress
Website: https://www.webstylepress.com
FaceBook: https://www.facebook.com/webstylepress
Twitter: https://twitter.com/webstylepress
GitHub: https://github.com/webstylepress
#ReactJS #JavaScript #JS #react #code #refactoring #10x #100x #vscode #extension #WebStylePress #webdevelopment

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Refactor Code 100x Faster in React JS | React JS Tutorial», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.