Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: ♻️ use built in context over pointless abstraction #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RusseII
Copy link
Member

@RusseII RusseII commented May 21, 2023

CleanShot 2023-05-21 at 09 45 58@2x

Removes JUNK boilerplate library that adds pointless abstractions and bloat!!

Recoil -> Context

The pull request aims to refactor the codebase by using the built-in context (GlobalContext) instead of the previous abstraction (Atoms.tsx). This change allows for better management and sharing of state across components using the context API.

ChatGPT

There are several reasons why it makes sense to use context over Recoil in certain scenarios:

  1. Simplicity: Context is a built-in feature of React and provides a straightforward way to share data across components. It has a simpler API compared to Recoil, which requires additional setup and configuration.

  2. Lightweight: Context has a minimal footprint and doesn't introduce any additional dependencies. It is a lightweight solution for managing and passing data between components.

  3. Familiarity: Context is a core concept in React and widely used in the React ecosystem. Many developers are already familiar with context and can easily understand and work with it.

  4. Integration with other React features: Context seamlessly integrates with other React features such as hooks and lifecycle methods. It can be used in combination with other React APIs without any compatibility issues.

  5. Performance: Context can provide good performance for most use cases. It leverages React's efficient diffing algorithm to optimize updates and minimize unnecessary re-renders.

  6. Flexibility: Context allows for flexible data sharing patterns. It can be used to pass down data from a parent component to deeply nested child components without having to pass props through intermediate components.

  7. App-wide state management: Context is well-suited for managing global or app-wide state. It provides a central place to store and access shared data, making it convenient for handling application-level state.

  8. Ecosystem support: Context is a widely adopted and supported feature in the React ecosystem. There are numerous libraries, tools, and resources available for working with context, making it easier to find solutions and community support.

While Recoil offers additional features such as atom management, selectors, and more advanced state management capabilities, context can be a simpler and more suitable choice for smaller applications or cases where the complexity and overhead of Recoil are not necessary.

@vercel
Copy link

vercel bot commented May 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2023 2:45pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant