refactor: ♻️ use built in context over pointless abstraction #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.
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.
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.
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.
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.
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.
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.
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.