{"action":"created","issue":{"url":"https://api.github.com/repos/treasure-data/redux-search/issues/48","repository_url":"https://api.github.com/repos/treasure-data/redux-search","labels_url":"https://api.github.com/repos/treasure-data/redux-search/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/treasure-data/redux-search/issues/48/comments","events_url":"https://api.github.com/repos/treasure-data/redux-search/issues/48/events","html_url":"https://github.com/treasure-data/redux-search/issues/48","id":170458207,"number":48,"title":"Simple Getting Started Examples Using React?","user":{"login":"acomito","id":12701635,"avatar_url":"https://avatars.githubusercontent.com/u/12701635?v=3","gravatar_id":"","url":"https://api.github.com/users/acomito","html_url":"https://github.com/acomito","followers_url":"https://api.github.com/users/acomito/followers","following_url":"https://api.github.com/users/acomito/following{/other_user}","gists_url":"https://api.github.com/users/acomito/gists{/gist_id}","starred_url":"https://api.github.com/users/acomito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acomito/subscriptions","organizations_url":"https://api.github.com/users/acomito/orgs","repos_url":"https://api.github.com/users/acomito/repos","events_url":"https://api.github.com/users/acomito/events{/privacy}","received_events_url":"https://api.github.com/users/acomito/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-10T16:17:55Z","updated_at":"2016-08-10T20:54:42Z","closed_at":"2016-08-10T16:35:00Z","body":"Are there any simple tutorials or examples around using react? I'm having some trouble parsing   the README.\r\n\r\nI keep running into this:\r\n\r\n`store.js:14 Uncaught TypeError: state.get is not a function`\r\n\r\nMy array of documents are stored in `state.opportunities`\r\n\r\nstore.js\r\n```\r\nimport { Tracker } from 'meteor/tracker';\r\nimport { createStore, applyMiddleware, compose } from 'redux';\r\nimport reducer from '../reducers/reducer';\r\nimport thunk from 'redux-thunk';\r\nimport { ProcurementOrgs } from '../../api/procurementOrgs/procurementOrgs';\r\nimport { ProcurementContacts } from '../../api/procurementContacts/procurementContacts';\r\nimport { ProcurementOpps } from '../../api/procurementOpps/procurementOpps';\r\nimport { reduxSearch } from 'redux-search'\r\n\r\n\r\nconst enhancer = compose(\r\n  applyMiddleware(thunk),\r\n  reduxSearch({ resourceIndexes: { opportunities: ['title'] },\r\n    resourceSelector: (resourceName, state) => { return state.get(resourceName) }\r\n  }),\r\n  window.devToolsExtension ? window.devToolsExtension() : f => f\r\n);\r\n\r\nexport default () => {\r\n\r\n  const store = createStore(reducer, enhancer);\r\n\r\n// basically gets documents from mongo and store them in redux\r\n  Tracker.autorun(() => {\r\n    store.dispatch({ type: 'SET__OPPS', payload: Opportunities.find().fetch()});\r\n  });\r\n\r\n  return store;\r\n};\r\n```\r\n\r\nindex.js\r\n```\r\n\r\n//top-level dependencies\r\nimport React from 'react';\r\nimport { connect } from 'react-redux';\r\n// components\r\nimport { Index } from '../pages/index';\r\nimport SubscribeComponent from '../../redux/redux-helpers/Subscribe-Component';\r\nimport { createSearchAction, getSearchSelectors } from 'redux-search'\r\n\r\n\r\nconst opportunities = state => state.getIn(['opportunities'])\r\n\r\nconst {\r\n  text,\r\n  result\r\n} = getSearchSelectors({\r\n  resourceName: 'opportunities',\r\n  resourceSelector: (resourceName, state) => state.get(resourceName)\r\n})\r\n\r\nclass IndexContainer extends React.Component {\r\n\r\n\r\n  componentWillMount() {\r\n    //runs a pub-sub subscription. Helps fill redux store (which is properly filled when I see devtool\r\n    this.props.subscribe('opportunities');\r\n  }\r\n\r\n  render() {  \r\n    return <Index />\r\n  }\r\n}\r\n\r\nconst mapStateToProps = state => {\r\n  return { \r\n  \topportunities: state.opportunities,\r\n  };\r\n};\r\n\r\n\r\nexport default connect(mapStateToProps)(SubscribeComponent(IndexContainer));\r\n```\r\n\r\nDo I need to add reselect to get this working?"},"comment":{"url":"https://api.github.com/repos/treasure-data/redux-search/issues/comments/239001067","html_url":"https://github.com/treasure-data/redux-search/issues/48#issuecomment-239001067","issue_url":"https://api.github.com/repos/treasure-data/redux-search/issues/48","id":239001067,"user":{"login":"bvaughn","id":29597,"avatar_url":"https://avatars.githubusercontent.com/u/29597?v=3","gravatar_id":"","url":"https://api.github.com/users/bvaughn","html_url":"https://github.com/bvaughn","followers_url":"https://api.github.com/users/bvaughn/followers","following_url":"https://api.github.com/users/bvaughn/following{/other_user}","gists_url":"https://api.github.com/users/bvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/bvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvaughn/subscriptions","organizations_url":"https://api.github.com/users/bvaughn/orgs","repos_url":"https://api.github.com/users/bvaughn/repos","events_url":"https://api.github.com/users/bvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/bvaughn/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T20:54:42Z","updated_at":"2016-08-10T20:54:42Z","body":"1. No problem at all. 😄  I ask questions all the time.\r\n2. Glad to hear that issue was simple to solve.\r\n\r\nThe `_id` thing is- unfortunately- not yet supported (see issue #16).\r\n\r\nYou could temporarily work around this by mapping your collections, like so:\r\n```js\r\nconst mappedOpportunities = opportunities.map((opportunity) => ({\r\n  ...opportunity,\r\n  id: opportunity\r\n}))\r\n```\r\n\r\nI'll try to make time to pick up #16 though since I realize this isn't a very appealing long-term solution."}}
{"actor":{"display_login":"bvaughn"}}