1.3 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.3 KiB
		
	
	
	
	
	
	
	
TypeScript
- avoid any; get rid of any existinganywhenever you can so that we can enable"strict": truelater on intsconfig.json
- define custom types for common data structures
- don't worry about interfacevstype, both are fine
 
- don't worry about 
Typescript and React/Next
- use React.FC<Props>type for React components, e.g.const MyComponent: React.FC<Props> = ({ ... }) => { ... };
- use NextPage<Props>for typing stuff insrc/pages/
- use generic versions of GetServerSideProps<Props>andGetStaticProps<Props>
React
- create one file per one component (tiny helper components in the same file are fine)
- name file identically to the component it describes (e.g. const DisplayQuestions: React.FC<Props> = ...inDisplayQuestions.ts)
- use named export instead of default export for all React components
- it's better for refactoring
- and it plays well with React.FCtyping
 
Styles
- use Tailwind
- avoid positioning styles in components, position elements from the outside (e.g. with space-* or grid/flexbox)
General notes
- use constinstead ofletwhenever possible
- set up prettier to format code on save