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

override dict in propsbase to use camelCase #3910

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions reflex/components/props.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@ def json(self) -> str:
return LiteralObjectVar.create(
{format.to_camel_case(key): value for key, value in self.dict().items()}
).json()

def dict(self, *args, **kwargs):
"""Convert the object to a dictionary.

Keys will be converted to camelCase.

Returns:
The object as a dictionary.
"""
return {
format.to_camel_case(key): value
for key, value in super().dict(*args, **kwargs).items()
}
Loading