Printer Logo

Printer

Please note the project has upgraded to Next App Directories in v2.x.x

Creating Slices

Slice generation follows a guided and structured pattern which involves a reducers.tsx file and a reducers.json file. Reducers.tsx are where code is automatically generated to import slice reducers into redux. Reducers.json keeps track of all the active reducers in the project. In the future, reducers.json may be deprecated and auto generation may be based on reducers in the folder.

λ Usage
λ printer slice [name of slice]
λ Example usage
λ printer slice example
λ ...
λ Which creates
λ redux/slice/example.tsx
λ And updates
λ redux/reducers.tsx
λ redux/reducers.json

Running this command generates the following code.

One of the highlights of Printer is the Slice injections possible with it. In order to leverage Printer inject commands. You need to add Printer decorators to your slice. Simply add a command with @printer::inject in order to flag a state or action for injection. For state, you can define a type to map it to by running @printer::inject::type. The following snippet demonstrates each context you can leverage an injection for.