Skip to content

[Rule Request] react-hooks/prefer-use-state-lazy-initialization #214

Closed
@SukkaW

Description

@SukkaW

Describe the problem

Disallow function calls in useState that aren't wrapped in an initializer function:

// Bad
const [value, setValue] = useState(generateTodos());
// Good
const [value, setValue] = useState(() => generateTodos());

Describe the solution you'd like

Port jsx-eslint/eslint-plugin-react#3579

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions