Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require that React.useState returned arguments has consistent naming pattern #655

Closed
bryceosterhaus opened this issue Sep 15, 2021 · 2 comments · Fixed by #686
Closed

Require that React.useState returned arguments has consistent naming pattern #655

bryceosterhaus opened this issue Sep 15, 2021 · 2 comments · Fixed by #686
Assignees

Comments

@bryceosterhaus
Copy link
Member

Enforce use of const [*, set*] = when using useState hook.

Valid

const [value, setValue] = useState();

Invalid

const [value, updateValue] = useState();
@bryceosterhaus
Copy link
Member Author

We might also add a rule for ref

// Pattern
const *Ref = useRef();

// Valid
const inputRef = useRef();

// Invalid
const node = useRef();

@matuzalemsteles
Copy link
Member

That would be nice, are good patterns to "enforce".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants