Tips
Here are some tips you can take into account when creating webcomponents with Atomico
Component name as function
Write the functional component using the first lowercase character, since the functional declaration is not instantiable as a constructor in JSX.
This prevents confusion when identifying the constructor of the component instance. Atomico if it supports instances as Constructors, see cases.β
useProp
preferably use useProp in the following cases:
By modifying the prop from inside the component.
By isolating the logic of the prop in a customHook.
In most cases downloading the prop from the first argument of the function is simpler and more declarative, example:
Atomico has type support in both JSDOC and Typescript by inferring the types of the props.β
Prefers the use of static styles
This does not rule out the use within the style tag, since it is sometimes the solution to the definition of conditional styles or variables to the logic and outside the scope of the custom properties.
Last updated