Is there any best practice in structure React app? Sometimes, I need to move universal functions to separate files. But, where? It's not a node_module.
src/
├─ actions/
├─ components/
├─ reducers/
├─ utils/ ← This is my utils folder.
│ ├─ DateUtils.js
│ ├─ NumberUtils.js
│ ├─ StringUtils.js
├─ views/
.git
.gitignore
node_modules/
package.json
The another way is creating Base react component that will contain all utils. All another react files will be child of this component.
class MyBaseComponent extends React.Component {
dateUtilsMethod() {
...
}
stringUtilsMethod(myString) {
...
}
}
class MainPageView extends MyBaseComponent { ... }
What is the best solution?