How I call other other functions from a helper file that isn’t a component?
I have multiple components using the same 3 functions but the 3 functions are all dependent on a dom event/event listener and requires the “this” to be passed down to other functions.
Do I need to create a functional component to hold these additional functions? What is the correct to call them?
NewItem.js
import React, { Component } from 'react'
import {funcA} from 'SomeHelper'
class NewItem extends Component {
constructor(props) {
super(props);
}
render() {
return(
<div>{funcA(userName, obj)}</div>
)
}
}
SomeHelper.js
export const funcA(userName, obj) => {
return console.log( funcB(userName, obj), funcCalculate(obj) )
}
funcB(userName, obj) => {
return "Hello World" + userName;
}
funcCalculate(obj) {
let value = 1 + 1;
//insert some code here.
return value;
}