Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 629 Bytes

README.md

File metadata and controls

35 lines (28 loc) · 629 Bytes

alt-resolver

A connect to stores that works with react-resolver

Example

import { resolver } from 'alt-resolver'
import React from 'react'
import UserStore from '../stores/UserStore'

class MyComponent extends React.Component {
  render() {
    return <div>Hello, {this.props.userName}!</div>
  }
}

resolver(MyComponent, {
  listenTo() {
    return [UserStore]
  },

  resolve() {
    return {
      user: Promise.resolve({ name: 'Jane' }),
    }
  },

  getProps(props) {
    return {
      userName: props.name,
    }
  },
})