@nx/react:redux

Create a Redux state slice for a React project.

Usage

1nx generate redux ... 2
1nx g slice ... #same 2

By default, Nx will search for redux in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

Show what will be generated without writing to disk:

1nx g redux ... --dry-run 2

Options

name

Required
string

Redux slice name.

directory

dir
string
Default:

The directory at which to create the Redux files. When --nameAndDirectoryFormat=as-provided, it will be relative to the current working directory. Otherwise, it will be relative to the project root.

appProject

a
string

The application project to add the slice to.

js

boolean
Default: false

Generate JavaScript files rather than TypeScript files.

nameAndDirectoryFormat

string
Accepted values: as-provided, derived

Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (as-provided) or generate it using the project and directory relative to the workspace root (derived).

project

pDeprecated
string

The name of the project to add the slice to. If it is an application, then the store configuration will be updated too.

Provide the directory option instead and use the as-provided format. The project will be determined from the directory provided. It will be removed in Nx v18.