Forum Discussion
react
- Anonymous9 years ago
I got this workaround from David Tittsworth...Thanks!
Add a global.js file with contents:
var React = window.React;
var ReactDOM = window.ReactDOM;
and then in pbiviz.json, add a reference to the global.js file in externalJS at the bottom.
This works!
Some more information: After looking around, I found people having similar problems. Their solution was found here:
https://github.com/Microsoft/PowerBI-visuals/issues/99
Essentially, when react is loaded, it's put onto a window object which, (due to sandboxing?) is mucked with and not available at the update call.
By saving the window in the constructor ( this.window = window;), I can later on do this in the update:
Anonymous
Power BI creates a copy of the window object in order to isolate custom visual's libraries from its own.
D3 works well due to special logic that binds d3 to the global context.
I suppose that we will get rid of isolation to simplify using external libraries.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- Anonymous9 years agoNot applicable
I got this workaround from David Tittsworth...Thanks!
Add a global.js file with contents:
var React = window.React;
var ReactDOM = window.ReactDOM;
and then in pbiviz.json, add a reference to the global.js file in externalJS at the bottom.
This works!