Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
ons object is undefined using React binding
-
Hey all. I’m trying to use the ons.platform utility object in my OnsenUI-React app, but it is undefined.
Is there something I need to do to get the utility object to be defined?
Thanks,
Scott
-
Hi @sherscher - since you’re using react I would suspect you are using some module loading system.
If you are you should be able to do something similar to either ofimport {platform} from 'onsenui'; var ons = require('onsenui');
If you’re not using such a system then you can just include it the old fashion way:
<script src="path/to/onsenui.js"></script>
And you will have the
ons
variable.
-
@IliaSky Thanks! That was it.