efstajas / svelte-stepper

🚶 A simple library for building delightfully animated stepped flows with Svelte.
https://svelte-stepper.jason-e.dev
141 stars 4 forks source link

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map') #1

Closed ethanfox closed 1 year ago

ethanfox commented 1 year ago

I followed the docs and I keep getting this error.

import { Stepper, makeStep } from '@efstajas/svelte-stepper';
    import FirmInfo from 'src/components/styledComponents/onboarding/completeProfile/FirmInfo.svelte';
    import PersonalInfo from 'src/components/styledComponents/onboarding/completeProfile/PersonalInfo.svelte';

    const profileSteps = [
        makeStep({
            component: FirmInfo,
            props: undefined
        }),
        makeStep({
            component: PersonalInfo,
            props: undefined
        })
    ];

Step Code:

    import { createStepController } from '@efstajas/svelte-stepper';

    const stepController = createStepController();
</script>

<h1>My first step</h1>

<button on:click={stepController.nextStep}>Next</button>
efstajas commented 1 year ago

Hey! Would you mind posting exactly what props you pass to the Stepper component? That error would probably be related to props.

ethanfox commented 1 year ago

I solved it. exampleSteps or any other value doesn't work. You have to just use steps

efstajas commented 1 year ago

@ethanfox Yep! The prop is called steps. Let me update the documentation not to use the prop shorthand syntax to make this clearer.

Closing this for now.

efstajas commented 1 year ago

Turns out I just had wrong variable names as props in the README in a few places. Just fixed this here: https://github.com/efstajas/svelte-stepper/commit/419d88302e4ad29a653dadfdbf945ca0e7847b40

Thanks a lot for the heads-up @ethanfox!