1.0.0 • Published 2 years ago

react-construct v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

react-construct

react-construct is a cli tool built for react apps to generate react components and other useful seperate files (eg. hooks).

Installation/Run


npx react-construct <command> <relativePath>

or

npm install react-construct -g or yarn global add react-construct

Usage


To use react-construct just type react-construct <commands> in your terminal.

CommandsDescription
fcFor functional components
fFor simple function file
hFor hook file
helpFor help
vFor version

Example

CommandsExample
fcreact-construct fc <component_name> <relative_path>
freact-construct f <function_name> <relative_path>
hreact-construct h <hook_name> <relative_path>
Functional component

react-construct fc Boo ./Foo/Faa, this command will generate required scalable files for a functional component.

|-- /Foo
    |-- /Faa
        |-- /Boo
            |-- Boo.tsx
            |-- Boo.model.tsx
            |-- Boo.styles.ts
            |-- Boo.constants.ts
            |-- Boo.view.tsx

FileDescription
Boo.tsxYour main FC file
Boo.model.tsxThis file will have your business logic
Boo.view.tsxYour view or JSX file
Boo.styles.tsxYour CSS file
Boo.constants.tsHere FC constants

Why such file structure?

  • Tons of lines of code hurts your eyes.
  • Imagine 10000+ line of a code in just a single file.
  • Searching\debugging becomes a mess.
  • Before adding something new in between will make you think twice.
  • Managing your components can become a mess.

After using react-construct

  • Your FC will split into seperate files.
  • Less line of a code in a file
  • Business logic, styles and view will be in a seperate file.
  • Wanna make some changes in view file, you know where to find.
  • Change in business logic, directly switch to model file and make the required changes.
  • Reviewing such FC code becomes damn easy.

#Project in progress...

1.0.0

2 years ago

0.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.3.0

6 years ago