Skip to content

Update ExampleTodoList.md #3738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

newtonkiragu
Copy link

@newtonkiragu newtonkiragu commented Mar 21, 2020

Declared var rootReducer then assigned it to function combineReducers


name: "\U0001F4DD Documentation Fix"
about: Fixing a problem in an existing Example: Todo List

Checklist

  • Is there an existing issue for this PR?
    • link issue here
  • Have the files been linted and formatted?

What docs page needs to be fixed?

What is the problem?

There is a rootReducer that is imported but never declared

// index.js
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import rootReducer from './reducers'
import App from './components/App'

const store = createStore(rootReducer)

render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById('root')
)
// reducers/index.js

import { combineReducers } from 'redux'
import todos from './todos'
import visibilityFilter from './visibilityFilter'

export default combineReducers({
  todos,
  visibilityFilter
})

What changes does this PR make to fix the problem?

It declares the rootReducer, then assigns it and finally exports it

// reducers/index.js

import { combineReducers } from 'redux'
import todos from './todos'
import visibilityFilter from './visibilityFilter'

let rootReducer = combineReducers({
  todos,
  visibilityFilter
});
export default rootReducer

Declared var `rootReducer` then assigned it to function `combineReducers`
@newtonkiragu newtonkiragu mentioned this pull request Mar 21, 2020
6 tasks
@netlify
Copy link

netlify bot commented Mar 21, 2020

Deploy preview for redux-docs ready!

Built with commit 11828ec

https://deploy-preview-3738--redux-docs.netlify.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants