I wanted to learn Rust and wanted to compare it to Go. So I made a simple CLI tool to generate some boilerplate react component files.
bash
cargo install react-component
bash
react-component --help
bash
react-component <component name> <...options>
bash
react-component Example --path src/components/examples
Generates three files:
src/components/examples/Example.component.tsx
```tsx import React from 'react';
export type ExampleProps = {};
export const Example: React.ComponentType
src/components/examples/Example.test.tsx
```tsx import { screen, render } from '@testing-library/react';
import { Example } from './Example.component';
describe('Example', () => {
it('renders', () => {
render(
src/components/examples/Example.stories.tsx
```tsx import { ComponentMeta, Story } from '@storybook/react';
import { Example, ExampleProps } from './Example.component';
const story: ComponentMeta
export const ExampleStory: Story
export default story; ```