Ynex -File Generate

Creating a Component

The easiest way to create a component is with the React CLI. You can also create a component manually.


Creating a component using the React CLI

To create a component using the React CLI:

  1. From a terminal window, navigate to the directory containing your application
  2. Run the generate-react-cli component <component-name> command, where <component-name> is the name of your new component.
generate-react-cli component <component-name>
By default, this command creates the following:
  • A folder named after the component
  • A component file, <component-name>.component
  • A template file, <component-name>.component.js
  • A CSS file, <component-name>.component.css
  • A testing specification file, <component-name>.component.spec.ts
Where <component-name> is the name of your component.