简体   繁体   English

与 StepZilla 反应:类型无效

[英]React with StepZilla: type is invalid

I tried to use the StepZilla Component from: https://github.com/newbreedofgeek/react-stepzilla but I have a problem.我尝试使用来自https://github.com/newbreedofgeek/react-stepzilla的 StepZilla 组件,但我遇到了问题。

I tried the following like explained in the StepZilla homepage:我按照 StepZilla 主页中的说明尝试了以下操作:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';

var StepZilla = require('react-stepzilla');
const steps =
    [
      {name: 'Step 1', component: <App />}
    ];

ReactDOM.render(<div className='step-progress'>
    <StepZilla step={steps}/>
</div>,document.getElementById('stepDemo'));

I always get the following error for the line <StepZilla step={steps}/> : React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.对于<StepZilla step={steps}/>行,我总是收到以下错误:React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got : 目的。

But I think this is correct, because in the example from the StepZilla page it's the same step variable.但我认为这是正确的,因为在 StepZilla 页面的示例中,它是相同的step变量。

I had the same problem, I solved it with a workaround, requiring it like this:我有同样的问题,我用一个变通方法解决了它,要求它是这样的:

var StepZilla = require('react-stepzilla').default;

See the answers of a similar question:查看类似问题的答案:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM