Skip to content

error : the prop 'onToggle' is required #4093

@makkaba

Description

@makkaba
Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.9.0
How did you install Swagger-UI? npm
Which browser & version? chrome
Which operating system? mac

Demonstration API definition

just simple test with react-create-app and official json(http://petstore.swagger.io/v2/swagger.json)

Expected Behavior

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import SwaggerUI from 'swagger-ui';

class App extends Component {
    componentDidMount(){
        SwaggerUI({
          dom_id: '#swContainer',
          url:'http://petstore.swagger.io/v2/swagger.json'
      });
    }
  render() {
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h1 className="App-title">Welcome to React</h1>
        </header>
        <div id="swContainer"></div>
      </div>
    );
  }
}

export default App;

Current Behavior

it looks like rendering successfully document page with a little flaw in css style.
but, in chrome console, error message
"Warning: Failed prop type: The prop onToggle is marked as required in t, but its value is undefined."

Possible Solution

life cycle problem maybe.
if i did it in wrong way, please update sample code more detail in guide.

Context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions