codu-code / codu

Codú's open-source codebase. A space for coders. Visit our community!
https://codu.co/
Apache License 2.0
120 stars 91 forks source link

Refactor PopularTags to Use useEffect and useState for Data Fetching #796

Open coderabbitai[bot] opened 6 months ago

coderabbitai[bot] commented 6 months ago

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

github-actions[bot] commented 6 months ago

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.

JohnAllenTech commented 6 months ago

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