I\'m setting up a React project with my team that will use mobX as state manager, plus TypeScript.
I\'ve seen a common pattern in the casing and naming patterns in R
It is common across many languages to PascalCase their classes and have camelCase functions and variable names. A JS example,
function hello() {console.log('world')};
class Foo {
say() { console.log('bar') }
}
let foo = new Foo();
foo.say();
components are often classes class Nav extends React.PureComponent and so the logical connection is to name the file containing the class similarly, resulting in matching case import statements import Nav from './Nav
You may also have a utility file, which exports a function, not a class. Again, it's nice to have matching cases import hello from './hello'
As such, you may find a common structure like
src
- App.js
- components/
- Nav.js
- util/
- hello.js