-
Notifications
You must be signed in to change notification settings - Fork 151
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
Spread ChakraProvider props to Provider Component #150
Conversation
🦋 Changeset detectedLatest commit: 7525f80 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This makes me wonder if we should just get rid of the |
@@ -1,8 +1,8 @@ | |||
import React from 'react'; | |||
import { ChakraProvider } from '@chakra-ui/react'; | |||
import { ChakraProvider, ChakraProviderProps } from '@chakra-ui/react'; | |||
|
|||
export interface ProviderProps {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason the GitHub suggestions interface is bugging out when I try to select multiple lines so I'll have to spread the suggestions across multiple comments 😬
Since we're already using interface
here, we can use extends
to clean this up a bit.
export interface ProviderProps {} | |
export interface ProviderProps extends ChakraProviderProps {} |
|
||
export interface ProviderProps {} | ||
|
||
export const Provider: React.FC<ProviderProps> = ({ children }) => { | ||
return <ChakraProvider>{children}</ChakraProvider>; | ||
export const Provider: React.FC<ProviderProps & ChakraProviderProps> = ({ children, ...props }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we don't need to use an intersection here since the type is already tied into ProviderProps
.
export const Provider: React.FC<ProviderProps & ChakraProviderProps> = ({ children, ...props }) => { | |
export const Provider: React.FC<ProviderProps> = ({ children, ...props }) => { |
Agree, not sure what the Provider is used for. If we need the ChakraProvider, why not just use it directly? |
If we don't have a |
That's what we are doing! We're just indirectly shipping it as our own provider. We're assuming that not everyone using this package needs to be educated about Chakra. |
What I meant was our Provider could simply use the ChakraProvider directly until we have something more to add to it. |
@Ibby-devv that's precisely what it's doing right now, I think. I am aware that we could just directly export the ChakraProvider as our own Provider but I prefer having a separate file and declaration like this. Purely my opinion though. |
Yeah that's fair enough. I'm on my phone so not sure if the changes I made were what you were looking for in terms of passing on the props to our component. |
I merged them in, they're fine! |
Closes #137
Description
Spread built in ChakraProviderProps to Provider Component.