Preact - Next.js - Deno - SSR - SSG 💻
Open source 📂
Machine learning 🤖
Books 📖
Sport 🏃♂️
Nature 🌱
Focus on being useful. I contribute AMAP to the OSS community. Love learning by doing.
Oh nice. I sort imports alphabetically, but not functions. But It looks another alternative.
As a curiosity, if you have a module with a main function (export default) and other functions that are used by the "main" function. Do you put the main function at the top and the others at the bottom in alphabetical order, or do you also order the "main" function?
Well, I spend most of my time doing React, which leverages functional components (very similar to a class). So with components, the component itself is the default export. Components can contain any number of functions. Inside the component, I always arrange my functions alphabetically.
In those cases where I'm defining standalone functions to be used across the app, I only ever define one function per file.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh nice. I sort imports alphabetically, but not functions. But It looks another alternative.
As a curiosity, if you have a module with a main function (export default) and other functions that are used by the "main" function. Do you put the main function at the top and the others at the bottom in alphabetical order, or do you also order the "main" function?
Well, I spend most of my time doing React, which leverages functional components (very similar to a class). So with components, the component itself is the default export. Components can contain any number of functions. Inside the component, I always arrange my functions alphabetically.
In those cases where I'm defining standalone functions to be used across the app, I only ever define one function per file.