Skip to content

$ is not defined #5975

@afgarcia86

Description

@afgarcia86

I have a class that is trying to do a get request in the componentDidMount function, however if I initially load a page with this component in it I get the following error. $ is not defined. I followed the example from xxx I just changed it over to ES6, perhaps I am using something improperly?

`
class NativeApp extends React.Component {

state = {
banners : {}
}

loadBanners() {
this.serverRequest = $.get('/api/banners', function (res) {
this.setState(res)
}.bind(this))
}

componentDidMount() {
this.loadBanners()
}

render() {
return (

Manually Load Banners WHY!!!

)
}
}

export default NativeApp
`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions