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

Formik field names are passed as props to story #56

Open
ekabolotina opened this issue Aug 11, 2022 · 0 comments
Open

Formik field names are passed as props to story #56

ekabolotina opened this issue Aug 11, 2022 · 0 comments

Comments

@ekabolotina
Copy link

ekabolotina commented Aug 11, 2022

Consider the example:

import { Meta, Story } from '@storybook/react';
import { DecoratorParams, withFormik } from '@bbbtech/storybook-formik';
import { SampleComponent, SampleComponentProps } from '.';

const meta: Meta<SampleComponentProps> = {
    title: 'SampleComponent',
    component: SampleComponent,
    decorators: [withFormik],
    parameters: {
        formik: {
            initialValues: {
                firstName: '',
                lastName: '',
            },
        },
    },
};

const Template: Story<SampleComponentProps> = (props) => <OkvedInput { ...props } />;
//                                             ^^^^^ 
//                        these props contain keys `firstName` and `lastName`

export const Default = Template.bind({});

The problem is that props passed to the Story contain keys from initialValues configured in parameters. This is very strange behavior.

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

1 participant