Sha256: 5bb32c1424d833a1f90fba4a22bbf1b28c9a1dea6655c0457463b03211f619df

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

# ReactOnRails JavaScript API
The best source of docs is the main [ReactOnRails.js](node_package/src/ReactOnRails.js) file. Here's a quick summary. No guarantees that this won't be outdated!

```js
  /**
   * Main entry point to using the react-on-rails npm package. This is how Rails will be able to
   * find you components for rendering.
   * @param components (key is component name, value is component)
   */
  register(components)

  /**
   * Allows registration of store generators to be used by multiple react components on one Rails
   * view. store generators are functions that take one arg, props, and return a store. Note that
   * the setStore API is different in tha it's the actual store hydrated with props.
   * @param stores (key is store name, value is the store generator)
   */
  registerStore(stores)

  /**
   * Allows retrieval of the store by name. This store will be hydrated by any Rails form props.
   * Pass optional param throwIfMissing = false if you want to use this call to get back null if the
   * store with name is not registered.
   * @param name
   * @param throwIfMissing Defaults to true. Set to false to have this call return undefined if
   *        there is no store with the given name.
   * @returns Redux Store, possibly hydrated
   */
  getStore(name, throwIfMissing = true )

  /**
   * Set options for ReactOnRails, typically before you call ReactOnRails.register
   * Available Options:
   * `traceTurbolinks: true|false Gives you debugging messages on Turbolinks events
   */
  setOptions(options)
```

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
react_on_rails-6.0.0.rc.4 docs/api/javascript-api.md
react_on_rails-6.0.0.rc3 docs/api/javascript-api.md
react_on_rails-6.0.0.rc.2 docs/api/javascript-api.md
react_on_rails-6.0.0.rc.1 docs/api/javascript-api.md
react_on_rails-6.0.0.beta.5 docs/api/javascript-api.md
react_on_rails-6.0.0.beta.4 docs/api/javascript-api.md
react_on_rails-6.0.0.beta.3 docs/api/javascript-api.md
react_on_rails-6.0.0.beta.2 docs/api/javascript-api.md
react_on_rails-6.0.0.beta.1 docs/api/javascript-api.md