Module: ReactWebpackRails::ReduxIntegration::ViewHelpers

Defined in:
lib/react_webpack_rails/redux_integration/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#redux_container(name, options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/react_webpack_rails/redux_integration/view_helpers.rb', line 17

def redux_container(name, options = {})
  container = Services::ReduxContainer.new('redux-container', name, options)

  rwr_element('redux-container', container.payload, container.options) do
    container.result['body'].html_safe
  end
end

#redux_router(name, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/react_webpack_rails/redux_integration/view_helpers.rb', line 25

def redux_router(name, options = {})
  router = Services::ReduxRouter.new('redux-router', name, options, request.path)
  result = handle_response_code(router.result, name, request.path)

  rwr_element('redux-router', router.payload, router.options) do
    result
  end
end

#redux_store(name, raw_props = {}, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/react_webpack_rails/redux_integration/view_helpers.rb', line 7

def redux_store(name, raw_props = {}, options = {})
  props = serialize_props(raw_props)

  if server_side(options.delete(:server_side))
    NodeIntegrationRunner.new('redux-store', name: name, props: props).run
  end

  rwr_element('redux-store', { name: name, props: props }, options)
end