Skip to content

Error: import or require() statements can be added only by editing a Markdown #1312

@davidpaley

Description

@davidpaley

I'm trying to make an example of my component in the Markdown file (.md). The problem is when I try to import something inside this markdown file:

import { validateEmail } from '../../utils/validation';

initialState = {
  value: 'asdas',
}

function updateValue(name, value) {
  setState({ [name]: value });  
}

<Input
  placeholder="Name"
  value={value}
  type="text"
  required={true}
  name="value"
  onChangeFunction={updateValue}
  validations={[validateEmail]}
/>;

When I go to the component it says:
Error: import or require() statements can be added only by editing a Markdown example file: ../../utils/validation

image

I tried also with require but it didn't work.

versions:

  • react-styleguidist": "^9.0.3"
  • "react": "^16.7.0",

Example of my project:
https://github.com/aimementoring/blueprint
branch: feature/validations

To reproduce

  • download the project and execute:
  • yarn
  • yarn deploy
  • serve -s styleguide
  • go to the input component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions