We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Can't pass props to Button if I give ButtonProps to Btn, is there any way to do that?
import { FC } from 'react' import { Button, ButtonProps } from 'rebass' const Btn: FC<ButtonProps> = ({...props}) => { return( <Button {...props}></Button> ) } export default Btn
The text was updated successfully, but these errors were encountered:
import { FC } from 'react' import { Button, ButtonProps } from 'rebass' import { ColorProps, SpaceProps, LayoutProps } from 'styled-system' const Btn: FC<ColorProps & SpaceProps & LayoutProps> = ({...props}) => { return( <Button {...props}></Button> ) } export default Btn
Sorry, something went wrong.
I think you are missing the children from FC
children
FC
The following works well for myself.
import React, { FC } from 'react'; import { Button as RebassButton, ButtonProps } from 'rebass'; const Button: FC<ButtonProps> = (props) => { const { children, ...rest } = props; return <RebassButton {...rest}>{children}</RebassButton>; }; export default Button;
(Edit: I have removed React.memo part as it's irrelevant to the question)
React.memo
Recently I faced the same problem as well. A solution would be to destructure css property { children, css, ...props }
No branches or pull requests
Here is the higher component I built based on rebass Button
Can't pass props to Button if I give ButtonProps to Btn, is there any way to do that?
The text was updated successfully, but these errors were encountered: