I wrote a React-App and now I want to implement some Tab-Navigation.
The problem is, my react app is integrated in a Symfony-Project that uses Twig templates. So my React-App lives in templates/dashboard/index.html.twig:
{% block content %}
<div id="react-app"></div>
{% endblock %}
And the tab-menu lives in templates/navigation/navbar.html.twig :
<div class="flex-1 px-4 flex justify-between">
<div id="react-tabs"></div>
</div>
react-App.js renders both of the apps.
import React from 'react';
import {render} from 'react-dom';
import {ready} from '../../helper/vanilla-helper'
import ReactTabs from "./ReactTabs";
function ReactApp() {
return (
<div className="App p-20 bg-blue-300">
Blubber
</div>
);
}
export default ReactApp;
ready(() => {
render(
<ReactApp/>,
document.getElementById('react-app')
);
render(
<ReactTabs/>,
document.getElementById('react-tabs')
);
});
I did quite a lot of research in the internet about sharing state. But it seems all of this is only related to sharing state inside of ONE ReactJs App and between their components.
In my case I need to share state between two apps. Is this even possible or should I take a complete different approach to this?