On which page do you see this issue?
https://flyonui.com/docs/framework-integrations/react/
Describe the issue
The examples on this page are very confusing. We have a mention of jQuery which is not supposed to be used together with React at all but what I really struggle to understand is the following snippet:
async function loadFlyonUI() {
return import('flyonui/flyonui');
}
...
function App() {
const location = useLocation();
useEffect(() => {
const initFlyonUI = async () => {
await loadFlyonUI();
};
initFlyonUI();
}, []);
useEffect(() => {
setTimeout(() => {
if (
window.HSStaticMethods &&
typeof window.HSStaticMethods.autoInit === 'function'
) {
window.HSStaticMethods.autoInit();
}
}, 100);
}, [location.pathname]);
return (
...
);
}
}
What probably should be added as information:
- Why do we need to use a dynamic import for
flyonui/flyonui inside a useEffect instead of a static import at the top of the file?
- Why do we need a second
useEffect which runs an autoInit() method depending on the pathname? This makes no sense to me because in a SPA we usually initialize the app only once and not on every page change. I don't understand what the Flyonui components have to do with the route path.
Overall the examples in this page don't follow React best practices and feel weird to use so any clarifications would be better.
What browsers are you seeing the problem on?
No response
On which page do you see this issue?
https://flyonui.com/docs/framework-integrations/react/
Describe the issue
The examples on this page are very confusing. We have a mention of jQuery which is not supposed to be used together with React at all but what I really struggle to understand is the following snippet:
What probably should be added as information:
flyonui/flyonuiinside auseEffectinstead of a static import at the top of the file?useEffectwhich runs anautoInit()method depending on the pathname? This makes no sense to me because in a SPA we usually initialize the app only once and not on every page change. I don't understand what the Flyonui components have to do with the route path.Overall the examples in this page don't follow React best practices and feel weird to use so any clarifications would be better.
What browsers are you seeing the problem on?
No response