Module: React

Defined in:
lib/react.rb,
lib/react/jsx.rb,
lib/react/jsx/template.rb,
lib/react/jsx/processor.rb,
lib/react/rails/railtie.rb,
lib/react/rails/version.rb,
lib/react/server_rendering.rb,
lib/react/rails/view_helper.rb,
lib/react/jsx/jsx_transformer.rb,
lib/react/rails/asset_variant.rb,
lib/react/jsx/babel_transformer.rb,
lib/react/rails/component_mount.rb,
lib/react/jsx/sprockets_strategy.rb,
lib/react/rails/controller_renderer.rb,
lib/react/rails/controller_lifecycle.rb,
lib/generators/react/install_generator.rb,
lib/generators/react/component_generator.rb,
lib/react/server_rendering/bundle_renderer.rb,
lib/react/server_rendering/exec_js_renderer.rb,
lib/react/server_rendering/manifest_container.rb,
lib/react/server_rendering/environment_container.rb,
lib/react/server_rendering/yaml_manifest_container.rb,
lib/react/server_rendering/webpacker_manifest_container.rb

Defined Under Namespace

Modules: Generators, JSX, Rails, ServerRendering

Class Method Summary collapse

Class Method Details

.camelize_props(props) ⇒ Hash

Recursively camelize `props`, returning a new Hash


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/react.rb', line 5

def self.camelize_props(props)
  case props
  when Hash
    props.each_with_object({}) do |(key, value), new_props|
      new_key = key.to_s.camelize(:lower)
      new_value = camelize_props(value)
      new_props[new_key] = new_value
    end
  when Array
    props.map { |item| camelize_props(item) }
  else
    props
  end
end