Whenever I try to pass other options to to_json on a react_component helper it is parsed just as plain string to the react prop.
<%= react_component "SelectableActivityLevel",
phase: UserService.active_phase(@user).to_json(methods: "pictures_url"),
activity_levels: @activity_levels
%>
Results in
this.prop.activity_levels //Object (correct)
this.prop.phase //String (incorrect)
The documentation of the gem says:
props is either an object that responds to #to_json or an already-stringified JSON object (eg, made with Jbuilder, see note below).
This did not help a lot.
The Jbuilder example did't help also because I'm using to_json.
Thanks for you help.