0

I used to import directly in index.html of public folder, or used helmet node module. And I used to import javascript files in useEffect() of react component. But sometimes I faced errors while loading page. If you know another way to import js files to react component, please post answer.

I tried like this import { Helmet } from 'react-helmet';

<Helmet>
    <meta charSet="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta property="og:image" content="https://knowme.tn/logo1.png" />
    <link rel="shortcut icon" href="logo3.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/assets/mondeo/css/master.css" />
    <link rel="stylesheet" type="text/css" href="/assets/revolution/css/settings.css"/>
    <link rel="stylesheet" type="text/css" href="/assets/revolution/js/layers.js" />
    <link rel="stylesheet" type="text/css" href="/assets/revolution/js/navigation.js"/>
</Helmet>
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Feb 19, 2024 at 5:57

1 Answer 1

0

I think using react-helmet module is the best way to import js files in reactjs.

Sign up to request clarification or add additional context in comments.

1 Comment

Could you leave sample code for better understanding?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.