Stateless React components should be named in PascalCase , so React can distinguish between native elements and components. Typescripts naming convention dictates that we should use lowerCamelCase or UPPER_CASE for the name of const variables.
How can I satisfy both (React and tslint)?
I think you have two options here:
Use where appopriate comment like this
/* tslint:disable-next-line:variable-name */
to disable tslint warning at that particular line
Use class components instead of functional ones.
您可以在tslint.json中添加以下规则:
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.