Sha256: 86a4c67a013e75eab87782d81120a390f4984d2bed3450f789bd6618622109b6

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

module ReactOnRails
  module Controller
    # Separate initialization of store from react_component allows multiple react_component calls to
    # use the same Redux store.
    #
    # store_name: name of the store, corresponding to your call to ReactOnRails.registerStores in your
    #             JavaScript code.
    # props: Ruby Hash or JSON string which contains the properties to pass to the redux store.
    #
    # Be sure to include view helper `redux_store_hydration_data` at the end of your layout or view
    # or else there will be no client side hydration of your stores.
    def redux_store(store_name, props)
      redux_store_data = { store_name: store_name,
                           props: props }
      @registered_stores_via_controller ||= []
      @registered_stores_via_controller << redux_store_data
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
react_on_rails-4.0.0.beta.1 lib/react_on_rails/controller.rb