LOKI LOKI - 1 month ago 11
React JSX Question

Uncaught TypeError : Cannot read property 'object' of undefined

import React, { Component } from 'react';
import Divider from 'material-ui/Divider';
import Paper from 'material-ui/Paper';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import List from 'material-ui/List/List';
import ListItem from 'material-ui/List/ListItem';
import Avatar from 'material-ui/Avatar';


export default class USMMAInfoContent extends Component {

getChildContext() {
return { muiTheme: getMuiTheme(baseTheme) };
}

render() {
return (

<div className="container employement-text">
<div className="row"> <br />
<h1>XXXXXXXXXXXXXX</h1> <hr /> <br />
<List>
<ListItem disabled={true} leftAvatar={<Avatar>S</Avatar>} >
<a href="/documents/xxxxx.pdf" target="_blank">xxxxxx Brochure (PDF Document)</a>
</ListItem>

<ListItem disabled={true} leftAvatar={<Avatar>U</Avatar>}>
<a href="/documents/xxxxx.pdf" target="_blank">xxxxxxx (PDF Document) </a>
</ListItem>


<ListItem disabled={true} leftAvatar={<Avatar>K</Avatar>}>
<a href="/documents/xxxxx.pdf" target="_blank">xxxxxx (PDF Document) </a>
</ListItem>


<ListItem disabled={true} leftAvatar={<Avatar>U</Avatar>}>
<a href="/documents/xxxxx.pdf" target="_blank">xxxxxxx (PDF Document)</a>
</ListItem>
</List>
</div>
</div>

);
}

}

USMMAInfoContent.childContextTypes = {
muiTheme : React.propTypes.object.isRequired,
};


I don't know what the exact error is here, but when i see developer tools in browser, It is saying Uncaught TypeError : Cannot read property 'object' of undefined.I ve added MUI control list and avatar.

Answer

You have misstyped PropTypes. It starts with capital letter:

React.PropTypes.object.isRequired,
// ---^