Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
How to add callbacks into an MDX file?

I'm trying to create a storybook story within an MDX file that uses a callback. I can't figure out how to do this and the docs are very light so I'm wondering if anyone knows how to approach this?

<Meta title="Components/Droplines" component={Droplines} />

export const DroplinesTemplate = (args) => (
    <Chart
        onStoreCreated={(store) => {
            store.dispatch({
                type: "EVENT.ADD_DROPLINE",
                payload: {
                    isHorizontal: true,
                    color: "steelblue",
                    x1: 150,
                    x2: 0,
                    y1: 150,
                    y2: 150,
                }
            });

            store.dispatch({
                type: "EVENT.ADD_DROPLINE",
                payload: {
                    isVertical: true,
                    color: "steelblue",
                    x1: 150,
                    x2: 150,
                    y1: 150,
                    y2: 0,
                }
            });
        }}
    >
        <Droplines />
    </Chart>

);

Whenever I try to put anything inside the callback I get warnings during the runtime and the storybook story is no longer available:

./src/components/Droplines/Droplines.stories.mdxModule build failed (from ./node_modules/@mdx-js/loader/index.js):SyntaxError: /home/ian/src/chart-it/src/components/Droplines/Droplines.stories.mdx: Unexpected token (14:15) 12 | y2: 150, 13 | }> 14 | });

Does anyone know what the correct approach is for adding in code to handle callbacks/events?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!