What I'm trying to achieve is to use a decorator (maybe Draper) to build an object before passing it to my React code (using the React Rails gem). I can easily decorate an object and use the methods in a view, but that is not possible if I pass an array through React props:
<%= react_component('Project', { name: project.name, choices: project.options %>
I won't be able access the decorated project.options.total
method in my JavaScript code.
Is there another way of building these objects? I was using Active Model Serializers in the past, but this is not a single page app, it's just a React component inside a Rails view.