Forum Discussion
Power BI Embedded for React possible?
Hi
Power BI and React do work well together... and there isn't too much that you need to do in order to get started.
I have written a couple of closed-source projects this way (but unfortunately cannot share the code here).
The Power BI Wiki (which you have probably already seen) details the use of most features, and once you have written the initial 'embed initialisation' code - all functions work as documented.
The trick is to make sure that changes in state/props don’t force a re-render of your embedding component.
A quick search highlighted this blog post and associated GitHub project (I am not associated with this project in any way) -> but this could act as a starter/guide for creating your own components. https://medium.com/@akshay5995/how-to-embed-microsoft-powerbi-charts-into-your-react-application-a3078edf5dc6 GitHub: https://github.com/akshay5995/powerbi-report-component
One last thing to consider.... Authentication!
You can perform embedding without server-side/backend services, but if you go down the 'app owns data' route - and use a data model that implements Row Level Security, then you will likely want to move the embedding-token generation logic/api calls to a backend service. Otherwise you will leave yourself open to security flaws by allowing users to potentially manipulate user roles within the browser.
Feel free to keep asking questions if you have anything more specific.
Hope this helps.
Cheers,
Matt