Reputation: 199
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
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