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.