codu icon indicating copy to clipboard operation
codu copied to clipboard

Refactor PopularTags to Use useEffect and useState for Data Fetching

Open coderabbitai[bot] opened this issue 1 year ago • 2 comments
trafficstars

In the context of PR https://github.com/codu-code/codu/pull/795, it was suggested to refactor the component to use and for data fetching and state management, aligning with React's best practices. This follows the pattern established in but is considered a good candidate for enhancement.

The current implementation uses an asynchronous function directly within the component, which is not typical for React components that perform data fetching. Refactoring this to use the React hooks for fetching data and for managing the tags state is suggested to improve code consistency and adherence to best practices.

This issue serves as a placeholder for someone to pick up and work on this enhancement, ensuring the component is optimized for maintainability and readability.

Related PR: https://github.com/codu-code/codu/pull/795 Related comment: https://github.com/codu-code/codu/pull/795#discussion_r1510340610

coderabbitai[bot] avatar Mar 03 '24 18:03 coderabbitai[bot]

Hello @coderabbitai[bot], thanks for opening your first issue! your contribution is valuable to us. The maintainers will review this issue and provide feedback as soon as possible.

github-actions[bot] avatar Mar 03 '24 18:03 github-actions[bot]

This may not make sense if the PR doesnt get approved but I followed the established pattern thats found in server/libs.posts.ts.

Therefore posts.ts also has this issue

JohnAllenTech avatar Mar 03 '24 18:03 JohnAllenTech