React v15+ Compatibility

Currently I am finding issues when trying to use the API with React v16.7.0. Is there any plans to release an updated API.js to work with newer versions of the React Library?

Hi Daniel,

What issues are you seeing? I don’t think I’ve done a build from scratch with React since 16.4, but I can’t think of anything new that should cause any problems.

Our own is a React app. You do need a moderately up to date PBX firmware image (6.2.20+) to use these properly as there are a few interesting issues with the login flow before then.

I have created a fresh app using create-react-app and have added the api.js reference to in the index.html (as per your react/redux example project) but I am getting 'IPCortex' is not defined no-undef compile errors when attempting IPCortex.PBX.Auth.setHost from the index.js but I can access the api functionality from the debug console.

I have implemented a work around for the moment by adding /* eslint no-undef: 0 */ // --> OFF to the top of the index.js

OK, understand what the issue is now. Loading api.js in index.html, essentially outside of the React module structure is quick and easy but trips up ESLint because the [window.]IPCortex object is only created when the anon function inside api.js is executed on page load so is invisible to the eslint pass.

There is probably a more specific eslint directive that would paper over this more safely.

A better but more complicated solution we are using internally, still dynamically loads the API JS from the PBX, but encapsulates this in an ES6 class so doesn’t have this issue. It also works in React Native where global objects are a real anti-pattern. I’ll try and find a way of making this generally useful, documenting and releasing it publicaly in the next few weeks.