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.

What is the purpose of the component property in CSF?

See original GitHub issue

This is just a question, not a bug report; I’ve scoured the docs looking for an answer but haven’t found any. The docs state that a CSF module should default-export a metadata object like

export default {
  title: 'Path|To/MyComponent',
  component: MyComponent,
  decorators: [ ... ],
  parameters: { ... }
}

What is the purpose of the component property? I’ve seen elsewhere that it is omitted, and I can’t tell what value it adds.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
shilmancommented, Oct 24, 2019

Right now, it’s only used in addon-docs. DocsPage uses it to automatically extract the props table & description of the component. However, it will get a lot more use in the future.

For example, stories for many non-react frameworks currently look like this:

export const basic = () => ({
  component: Blah
  template: '<blah>blah</blah>'
})
export const disabled = () => ({
  component: Blah
  template: '<blah :disabled=true>disabled</blah>'
})

Other uses include addons that want to associate component-related statistics on top of the stories. For example, I recently prototyped a code coverage addon that relies on component.

1reaction
shilmancommented, May 4, 2020

Updated the docs per your suggestion @ekilah

Also see https://github.com/storybookjs/csf/pull/5 which will be incorporated into a broader Storybook TS upgrade soon

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cerebrospinal fluid (CSF): Definition, Function, and Composition
The purpose of CSF is to provide nutrients, remove waste, and cushion the brain and spine. The normal composition of CSF is a...
Read more >
Physiology, Cerebral Spinal Fluid - StatPearls - NCBI Bookshelf
CSF provides hydromechanical protection of the neuroaxis through two mechanisms. First, CSF acts as a shock absorber, cushioning the brain ...
Read more >
CSF Cerebrospinal Fluid - Physiopedia
Cerebrospinal fluid (CSF) plays an essential role in maintaining the homeostasis of the central nervous system. The functions of CSF include: (1) buoyancy...
Read more >
Cerebrospinal fluid - Wikipedia
Cerebrospinal fluid (CSF) is a clear, colorless body fluid found within the tissue that surrounds the brain and spinal cord of all vertebrates....
Read more >
Properties and contents of cerebrospinal fluid
The active transport component of CSF production relies on the active transport of sodium and chloride, with water movement through ...
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