How to use the defaults.options.reducers function in defaults

To help you get started, we’ve selected a few defaults examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mirrorjs / mirror / test / defaults.spec.js View on Github external
it('should update `options.reducers` if call defaults multiple times', () => {
    defaults({
      reducers: {
        a: () => 'a'
      }
    })
    expect(Object.keys(options.reducers)).toEqual(['a'])

    const container = document.createElement('div')
    render(<div>, container)
    expect(store.getState().a).toBe('a')

    defaults({
      reducers: {
        b: () =&gt; 'b'
      }
    })
    expect(Object.keys(options.reducers)).toEqual(['a', 'b'])

    render()
    expect(store.getState().b).toBe('b')

  })</div>
github mirrorjs / mirror / test / defaults.spec.js View on Github external
reducers: {
        a: () =&gt; 'a'
      }
    })
    expect(Object.keys(options.reducers)).toEqual(['a'])

    const container = document.createElement('div')
    render(<div>, container)
    expect(store.getState().a).toBe('a')

    defaults({
      reducers: {
        b: () =&gt; 'b'
      }
    })
    expect(Object.keys(options.reducers)).toEqual(['a', 'b'])

    render()
    expect(store.getState().b).toBe('b')

  })
</div>