import makeOrganism from '../../../src'
import * as loadItemsState from '../state/placeholderAPI'
import Items from '../components/Items'

// export default makeOrganism(Items, loadItemsState)

const baseURL = 'https://jsonplaceholder.typicode.com'
const fetchAPI = (path) => fetch(baseURL + path).then(r => r.json())

export default makeOrganism(Items, {
  initial: () => ({ items: null }),

  load: async ({ path }, prevProps, { handlers }) => {
    if (!prevProps || path !== prevProps.path) {
      handlers.initial()
      return { items: await fetchAPI(path) }
    }
  }
})

import makeOrganism from '../../../src'
import * as loadItemsState from '../state/placeholderAPI'
import Items from '../components/Items'

// export default makeOrganism(Items, loadItemsState)

const baseURL = 'https://jsonplaceholder.typicode.com'
const fetchAPI = (path) => fetch(baseURL + path).then(r => r.json())

export default makeOrganism(Items, {
  initial: () => ({ items: null }),

  load: async ({ path }, prevProps) => {
    if (!prevProps || path !== prevProps.path) {
      return { items: await fetchAPI(path) }
    }
  }
})

Fix issue with example expecting other handlers to be passed to load handler
Fix issue with example expecting other handlers to be passed to load handler
