I’m Emmanuel Katto from Uganda, and I’m seeking guidance on integrating a React app, specifically a Mapbox map with advanced functionalities, into our Bubble application.
Here’s what we aim to achieve:
Display the Mapbox map on a separate page within our Bubble app.
Ensure the map retrieves data from our Bubble database seamlessly.
Is it feasible to achieve this integration? Are there any tutorials or guides available that could help us navigate this process effectively?
Your valuable suggestions and insights would be greatly appreciated. Thank you in advance for your assistance!
Yes it’s “feasible”. You’ll need to put your react map-box in an iFrame then use PostMessages or URL parameters to communicate to the iFrame from your Bubble App.
I’m only explaining cause there are other people that will likely read this. I’m not sure why you can’t simply Google something when you don’t know about it before you make comments.
You can add event listeners that accept or send messages to an iFrame in which can take any JSON object like so:
parent.postMessage({ "Type": ""Login }, "*");
then your listener would look like:
window.addEventListener("message", (event) => {
console.log("Received data from child iframe ", event.data);
});
You obviously want to incorporate your target origin, or you will run into COR’s errors (unless you want others to send unauthorized messages – which is not recommended).