CartoDB / carto-react-template

CARTO for React. The best way to develop Location Intelligence (LI) Apps usign CARTO platform and React
https://sample-app-react.carto.com
MIT License
39 stars 26 forks source link

Improve styleguide in hygen template #238

Closed aaranadev closed 3 years ago

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/carto-frontend/cra-template-carto/4FYz1F7tSSXz5opXNwqxooFF8Ya8
✅ Preview: https://cra-template-carto-git-feature-ch160565-carto-frontend.vercel.app

shortcut-integration[bot] commented 3 years ago

This pull request has been linked to Clubhouse Story #160565: Improve styleguide in hygen template.

aaranadev commented 3 years ago

More harder that this?

Screenshot 2021-06-16 at 08 58 04

alasarr commented 3 years ago

You're introducing two ways of import.

More harder that this?

It's not a problem about default, it's a problem of the name of the function

aaranadev commented 3 years ago

I think the functionality if you reference the function named formulateModel the destructuring is unnecessary.

For example:

import getFormulaModel from 'data/models/FormulaModel';
aaranadev commented 3 years ago

The documentation:

Named exports are useful to export several values. During the import, one will be able to use the same name to refer to the corresponding value. Concerning the default export, there is only a single default export per module. A default export can be a function, a class, an object or anything else. This value is to be considered as the “main” exported value since it will be the simplest to import.

alasarr commented 3 years ago

In general, a model should have more than 1 function. For example StoresModel could have: getStoreById, getAllStores, findNearestStore...

You can do:

import getStoreById, {getAllStores, findNearestStore} from ...

I know it's allowed and in several libraries (like react for example) is useful because a method is clearly more used than the rest, but not apply for models

aaranadev commented 3 years ago

Ok, I understand, I change it

aaranadev commented 3 years ago

Done