Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

No default rendered for particular prop #79

Open
ffloyd opened this issue Jan 5, 2020 · 0 comments
Open

No default rendered for particular prop #79

ffloyd opened this issue Jan 5, 2020 · 0 comments

Comments

@ffloyd
Copy link

ffloyd commented Jan 5, 2020

Storybook 5.2.8 + React + TypeScript, custom config (no CRA or Next).

Interface:

import React from "react";

import { Button } from "@material-ui/core";

export interface HelloProps {
  /**
   * Text to display
   * @default "just for test"
   */
  text: string;
  /**
   * Event to execute.
   * @default () => {}
   */
  onClick: () => void;
}

const defaultOnClick: HelloProps["onClick"] = () => {};

/** Testing component. */
export const Hello: React.FunctionComponent<HelloProps> = ({
  text,
  onClick = defaultOnClick
}) => (
  <div>
    <Button variant="contained" color="primary" onClick={onClick}>
      {text}
    </Button>
  </div>
);

For the first prop default is rendered, but not for the second one:

Screen Shot 2020-01-05 at 03 38 26

I'm ready to provide more context if this is not enough to reproduce.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant