Skip to content

How to use? #20

@Tzikas

Description

@Tzikas

I'm a little confused about the example: I have

handleScriptCreate() {
  this.setState({ scriptLoaded: false })
}
 
handleScriptError() {
  this.setState({ scriptError: true })
}
 
handleScriptLoad() {
  console.log(this)
  this.setState({ scriptLoaded: true })
  $('body').click(function(){
		alert('up')
   })
}
 
render() {
   return(

    <Script
      url="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
      onCreate={this.handleScriptCreate.bind(this)}
      onError={this.handleScriptError.bind(this)}
      onLoad={this.handleScriptLoad.bind(this)}
    />
  )
}

and I'm getting a error '$' is not defined . jQuery in component did mount doesn't work either. What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions