0

I wanna to use a custom theme in my react app that has two class added to head tag like this x.js & y.js

Slso there is main.js that added to bottom of body tag when called functions inside main.js after componendDidMount() in App.tsx.

Sometime couldn't find the classes that created in for example x.js but some times that found?

In short a want to call some functions in external .js files after entire page were loaded is it possible in React?

I mean how access an object in an external script from other In here an object exist in x.js and I want call it from main.js

Alireza
  • 128
  • 1
  • 12
  • Does this help? https://css-tricks.com/theming-and-theme-switching-with-react-and-styled-components/ – evolutionxbox Jul 19 '23 at 09:11
  • This might help: https://stackoverflow.com/questions/53396307/how-do-i-use-external-script-that-i-add-to-react-js – Phanisimha N R Jul 19 '23 at 10:29
  • I mean how access an object in an external script from other In here an object exist in `x.js` and I want call it from `main.js` – Alireza Jul 19 '23 at 15:38
  • 1
    Can you split each question into one StackOverflow question? There are a lot of questions in here that seem unrelated, and it seems like there is an assumption that to use theme you need to use classes and to call external functions in another js file and to get an object in another js file, but none of those are necessary – Codebling Jul 19 '23 at 15:42
  • 1
    Usually in React, if you want to use code in another Javascript file, you import it in React, not in HTML. Don't add any ` – Codebling Jul 19 '23 at 15:45
  • @Codebling thank you, you know those files are use to config of theme and I didn't write that. – Alireza Jul 19 '23 at 15:49
  • 1
    @Alireza you can still add them to your React source code and import the classes you need – Codebling Jul 19 '23 at 15:53

0 Answers0