AndroidKid
AndroidKid

Reputation: 199

How to use existing javascript codes in react components

I am new to React Js. I have some normal javascript codes for frequently used calculations and etc and it has lots of javascript codes.

Now i am moving to React Components and like to use same codes which i have written in plain javascript in my react components instead of re-writing everything.

Kindly help me on this.

Upvotes: 0

Views: 81

Answers (1)

FurkanO
FurkanO

Reputation: 7308

Think of creating a util/ or lib/ folder on the root of your project. You can export those functions etc and use anywhere as you would normally.

There is nothing related to react, except you shoudn t try to update the dom via plain JS. Shortly, let react do what it does, elsewhere use your own util, lib helpers without issues.

Upvotes: 1

Related Questions