【发布时间】:2018-01-08 22:09:51
【问题描述】:
我正在尝试渲染几个按钮,但由于某种原因没有任何反应。我不确定我的错误在哪里。我有一个 OverviewRender 类,它最终将处理要呈现的不同按钮集,以及一个调用 OverviewRender 来呈现按钮的 Overview 类。
感觉应该可以工作,但按钮没有呈现。如果我移动概览返回函数中的按钮,我可以看到它们。
import React, { Component } from 'react'
import SearchBar from 'material-ui-search-bar'
import sass from '../scss/application.scss'
import PropTypes from 'prop-types'
import RaisedButton from 'material-ui/RaisedButton'
class OverviewRender extends Component {
render() {
const mainMenu = () => {
return (
<div>
<RaisedButton label="File Options"
style={{
height: '80px',
width: '180px',
fontSize: '44px',
padding: '1px'}}
/>
<RaisedButton label="Setup Options"
style={{
height: '80px',
width: '180px',
fontSize: '44px',
padding: '1px'}}
/>
<RaisedButton label="More Options"
style={{
height: '80px',
width: '180px',
fontSize: '44px',
padding: '1px'}}
/>
</div>
)
}
return (
<div>
{mainMenu}
</div>
)
}
}
class Overview extends Component {
constructor(props){
super(props)
this.state = {
open: false
}
}
render() {
return (
<div className="menuButtons">
<OverviewRender />
</div>
)
}
}
export default Overview;
【问题讨论】:
标签: reactjs components render