1

I have a working Rails form in which I'm trying to implement one field as a React Component (as an input with autosuggester). I have the React autosuggester working perfectly (so I don't want to use a library for it), and now I'm trying to figure out how to get the selection back in the form_for data. The form currently looks something like this:

<%= form_for (@user, url: :interests_path, method: :put) do |f| %>
  <%= f.fields_for :user_interests do |builder| %>
    <%= f.text_field :title %>
    <%= react_component(...(@interests already passed in successfully) %>
  <% end %>
<% end %>

The react component has an input field in it, and I'd like to get the value of that back into the form somehow. Is there a way to grab it from its parent container? Any suggestions greatly appreciated.

Ando
  • 165
  • 1
  • 14

0 Answers0