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

Type mismatch: ResponsiveBar=> label #2478

Closed
HirajGajera007 opened this issue Nov 29, 2023 · 1 comment
Closed

Type mismatch: ResponsiveBar=> label #2478

HirajGajera007 opened this issue Nov 29, 2023 · 1 comment

Comments

@HirajGajera007
Copy link

HirajGajera007 commented Nov 29, 2023

For the ResponsiveBar: label is not accepting a component.

<ResponsiveBar
    data={barData}
    label={({ value }: { value: number | null }) => {
                            if (value) return <tspan y={-10}>{`${value.toLocaleString()} km`}</tspan>;
                            else return <tspan y={-10}>{'0 km'}</tspan>;
                        }} />

Error:

Screenshot 2023-11-29 at 18 56 28
@plouc
Copy link
Owner

plouc commented Mar 7, 2024

It's not a type mismatch, label should return a string, as it's also used for the canvas implementation, which cannot render JSX.

@plouc plouc closed this as completed Mar 7, 2024
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

No branches or pull requests

2 participants