1.0.0 • Published 4 years ago
react-use-luigi v1.0.0
React-Luigi
This is a collection of hooks / utilities to use in a Luigi (https://luigi-project.io/) micro-frontend application. Any pull request for optimisations and new additions is more than welcome.
Installing use-react-luigi
npm install use-react-luigi
Usage
Navigate to a route and synchronise with Luigi
- This will trigger a refresh of the iframe
import { navigateWithSync } from 'use-react-luigi';
const Component = () => (
<button onClick={() => navigateWithSync('/pathname')}>
Navigate
</button>
);
Navigate to a route without synchronising with Luigi
- This will not trigger a refresh of the iframe
import { navigateWithoutSync } from 'use-react-luigi';
const Component = () => (
<button onClick={() => navigateWithoutSync('/pathname')}>
Navigate
</button>
);
Configure a React app to update Luigi route every time when the internal location path is changing
- This is an operation that should be done once per application.
import { useSyncRoute } from 'use-react-luigi';
const App = () => {
useSyncRoute();
return (...);
}
Use Luigi context
import { useContext } from 'use-react-luigi';
const Component = () => {
const context = useContext();
return (...);
}
1.0.0
4 years ago