javascript - ReactJS Modal hide by jquery imported via NPM -
i know should not use jquery in react app. will.
now got out of way, keep getting: __webpack_imported_module_4_jquery___default(...)(...).modal not function
i import jquery this:
import $ 'jquery'; class reporttab extends component { test(){ $('#mymodal').modal('hide') } render() { return ( <div> <button onclick={this.test.bind(this}>close</button> <div classname="modal fade" id="mymodal" role="dialog"> <div classname="modal-dialog"> <div classname="modal-content"> <div classname="report-daypicker-container"> <daypicker ondayclick={this.test.bind(this)}/> </div> <div classname="close-modal-container"> <button classname="global-button global-button-active close-modal-btn" data-dismiss="modal">cancel</button> </div> </div> </div> </div> </div> ) } }
try:
$('#mymodal').hide(); if doesn't work make sure have 1 element id mymodal being rendered.
Comments
Post a Comment