I am currently studying ReactJS. I'm coding in JSX style, but I have a question. How do I use the regularly-formatted JavaScript library I used?
E.g
myScript.js
(function () {
var myTemp = "myTemp";
function myFunction() {
console.log("myFunction()")
}
function myFunction1() {
console.log("myFunction()")
}
function myFunction2() {
console.log("myFunction()")
}
function myFunction3() {
console.log("myFunction()")
}
}
When you have a JavaScript library of the above source, What methods can you use in JSX or ReactJS? Do I have to convert this to JSX and use it?
process.js is
import myScript from '~~~~/myScript'
export function proc() {
myScript.myScript.myFunction();
}
sample.js is
import process from '~~~~/process'
export function sample() {
process.proc();
}
Sample.js
import React, {Component} from 'react';
import * as sample from '~~~.sample';
class mySample extends Compoonent {
click = () => {
sample.sample()
}
render() {
return (
<button onClick={this.click}> button </button>
)
}
}
export default Sample;
i don't know how to import myScript.js ( normal format javascript like Library ) and call MyScript.js functions...