Skip to content

v1.3.0

Compare
Choose a tag to compare
@wpdas wpdas released this 03 Jun 21:20
· 1 commit to main since this release
d5f2dd3

News

1 - Compile a stateless component as stateful. This will not add states to the component. When using this method, the component is generated as a Widget. This setting can also be useful to force the file to be created separately if you configure the project to create separate files for stateful components.

To force transform a stateless component into a stateful one, simply add the following signature "as stateful"; at the top, for example:

"as stateful";

const Spinner = () => (
  <div className="spinner-border" role="status">
    <span className="visually-hidden">Loading...</span>
  </div>
);

export default Spinner;

2 - Configuration to eject stateful components. This causes each stateful component to be generated in a separate file. Use the alem.config.json file to set the following configuration:

options: {
  ejectStatefulComponents: true
}

Result:
separate-components