question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display of Template inside Story not as expected

See original GitHub issue

Describe the bug To Reproduce

I have the following code inside a mdx file:

export const Template = (args) => <Button {...args} />;

<Preview>
  <Story
    name="Interactive"
    args={{ label: "Primary button ", state: "primary" }}
  >
    {Template.bind()}
  </Story>
</Preview>

When I view the relevant Docs page in the browser and click on the “Show code” link, the following is shown:

<MDXCreateElement
  buttonType="button"
  label="Primary button "
  mdxType="Button"
  originalType={() => {}}
  state="primary"
/>

Expected behavior

I expected it to output the following:

<Button label="Primary button" state="primary" />

Screenshots

Screenshot 2020-08-05 at 15 46 23

System:

Environment Info:

  System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
  Binaries:
    Node: 14.5.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
  Browsers:
    Firefox: 78.0.2
    Safari: 13.1.1
  npmPackages:
    @storybook/preset-create-react-app: ^3.1.4 => 3.1.4 
    @storybook/react: ^6.0.0-rc.26 => 6.0.0-rc.26

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
marie-maximecommented, Aug 5, 2020

Looks similar to https://github.com/storybookjs/storybook/issues/11542

I’m guessing this a bug or maybe the doc for controls is not updated, but you can do this as a workaround and it should output the code correctly:

<Preview>
  <Story
    name="Interactive"
    args={{ label: "Primary button ", state: "primary" }}
  >
    {args => <Button {...args} />}
  </Story>
</Preview>
0reactions
shilmancommented, Sep 25, 2020

closing as dupe to #11542

Read more comments on GitHub >

github_iconTop Results From Across the Web

Count method in Django template not working as expected
I tried using the count method but, it retrieved the total number of comments in my comments table instead of the number of...
Read more >
The Content Template element - HTML - MDN Web Docs
firstClone is a DocumentFragment instance, so while it gets appended inside the container as expected, clicking on it does not trigger the click ......
Read more >
User Story Templates, Examples, & Formulas for ... - AHA.io
Simple user story template. This starter template will help you write user stories and acceptance criteria and organize them in one easy-to-read view....
Read more >
User Story Template Advantages - Mountain Goat Software
In my user stories book and in all my training and conference sessions on user stories, I advocate writing user stories in a...
Read more >
Development guide for GitLab CI/CD templates
If the template is intended for copy-paste usage only, it might be possible to ... Users may want to use an older stable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found