【问题标题】:Unknown prop warning react js `iconClassNameRight`未知道具警告反应 js `iconClassNameRight`
【发布时间】:2017-06-21 19:45:34
【问题描述】:

您好,我想知道为什么它会在控制台上发出警告

Warning: Unknown prop `iconCLassNameRight` on <div> tag. Remove this prop from the element. For details, see link fb me
    in div (created by Paper)
    in Paper (created by AppBar)
    in AppBar (created by App)
    in div (created by App)
    in MuiThemeProvider (created by App)
    in App

我正在处理的代码是在meteorjs和material ui上

import React, { Component } from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import RaisedButton from 'material-ui/RaisedButton';
import AppBar from 'material-ui/AppBar';

import Player from './Player.jsx';
import TeamList from './Team-list.jsx';
import TeamStats from './Team-stats.jsx';

export default class App extends Component {
  render(){
    return (
      <MuiThemeProvider>
        <div className="container">
          <AppBar
            title="Soccer Application" iconCLassNameRight="muidocs-icon-navigation-expand-more" showMenuIconButton={false} />
            <div className="row">
              <div className="col s12 m7"> <Player /> </div>
              <div className="col s12 m5"> <TeamStats /> </div>
              <div className="col s12 m5"> <TeamList /> </div>
            </div>
          </div>

        </MuiThemeProvider>
      )
    }
  }

我想知道为什么这会引发错误。感兴趣的行在 appbar 组件的 iconClassNameRight 属性中。任何帮助将不胜感激。谢谢。

【问题讨论】:

  • 错误出现在 Paper 组件中,但您正在显示 App。也粘贴纸,这样我们就可以看到道具从一个到另一个流动(propTypes 也会很有帮助)。

标签: html css reactjs meteor


【解决方案1】:

React 中的道具区分大小写。

尝试将iconCLassNameRight(大写L)替换为iconClassNameRight(小写L)

【讨论】:

    猜你喜欢
    • 2017-03-11
    • 1970-01-01
    • 2018-11-28
    • 2017-08-28
    • 1970-01-01
    • 2018-02-01
    • 2017-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多