I want to create tools class/function in nextjs
I have 2 ways for this.
With static class:
class Tools {
static titleCase(value: string) {
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
}
}
export default Tools
With use function:
export default function Tools(){
function titleCase(value: string) {
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
}
return { titleCase }
}
And here is my question:
1- Which is better?
2- What is difference between these?