-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Use snake_case for components #779
Comments
We'll need to complete reactive-python/reactpy-flake8#9 in order to resolve this. |
I actually prefer PascalCase because even though the implementation is a decorated function, you're using it like its a class. |
But this makes a lot of linters and IDEs not happy. We shouldn't have to make people modify their linting config to use ReactPy without getting warnings. |
Alright, I did some research then consulted with GPT-4 and it's voting snake_case. Here's that discussion: https://chat.openai.com/share/3788cfb9-d017-4659-bbc2-9476400c3e25 I don't feel strongly about this. It's worth calling out that GPT-4 suggested that pascal vs snake case was a differentiator in tsx / jsx files but I don't see any clear technical reason. I think based on what I know now, the question is whether pyx files may exist in the future and if we want to see this: <MyComponent foo="1" /> or this: <my_component foo="1" /> Aesthetically, PascalCase feels better IMO. GPT-4 seems to insist the naming convention is important in React. Again, I'm not sure there's any real technical reason for a theoretical pyx to strictly use one over the other. We're not sure pyx should even exist.
One final side effect to consider is whether strictly following pep8 and existing linters would drive people to use class based components which are more verbose. |
Current Situation
We currently promote using PascalCase for components, following ReactJS convention. However, this very much goes against PEP8.
See original discussion:
Proposed Actions
Rewrite the docs to promote snake_case usage.
The text was updated successfully, but these errors were encountered: