Open dev-george-nikolaidis opened 8 months ago
@dev-george-nikolaidis
I agree with this. The Library.jsx is quite large. If you would like to work on it I have some ideas and suggestions and you're welcome to make any improvements you see necessary. It does need extensive refactoring.
@gbowne1 What ideas and suggestions do you have in mind? Let's leave the issue open for new people ? If nobody wants to work on this, I will let you know to take it.
@dev-george-nikolaidis
My suggested improvements for Library.jsx would be listed in one of the current PRs as a comment:
https://github.com/gbowne1/codebooker/pull/215#issuecomment-1973972515
Its unfinished code so the implementation needs to be completed but.. you can probably see where I was headed with that.
This reduces some of the import lines by grouping them together like the @mui imports currently listed over several lines
It also attempts to fix the useState imports, change some fo async functions and const arrow functions where necessary
Also its attempts to fix the returned components which make the code cluttered.
What ideas do you have?
@gbowne1 I'm thinking about suggesting the use of the Higher-Order Component (HOC) pattern in React to break down our large Library.jsx into smaller, more manageable components. HOCs could help us encapsulate shared logic and make our codebase more modular and easier to maintain. It seems like a good way to improve reusability and organization, especially as our project grows. What do you think?
@dev-george-nikolaidis
Our code for Library.jsx is close to 900 lines.
What do you think of my idea?
However I am all for reuseable code and making it more maintainable
My other idea was to create imported js modules to extract the many functions and states we are using
We should also be looking at making use of more useState, useEffect, useRef, useMemo, useCallback, etc and others where they make sense but those are probably the most useful.
@gbowne1 I like your idea. However, generally, it's not good to have many useEffects in one component for several reasons such as maintainability, readability, and performance. 900 lines is considered a large component in the context of React development in my opinion.
Ok. Well this issue is open.
Hello,
I've been working with
Library.jsx
and observed that its large size contributes to difficulty in maintenance, readability issues, and triggers unnecessary re-renders.Suggestion: Refactoring
Library.jsx
into smaller, component-based files could significantly enhance our codebase by improving readability, making maintenance easier, and potentially optimizing performance by reducing unnecessary re-renders.Benefits:
I believe this change could lead to more efficient development workflows and a more robust application. Looking forward to your thoughts and feedback on this proposal.
Best, George