Skip to content

Commit

Permalink
override dict in propsbase to use camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Sep 11, 2024
1 parent 63bf1b8 commit f1ee584
Showing 1 changed file with 13 additions and 0 deletions.
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()
}

0 comments on commit f1ee584

Please sign in to comment.