I am working on movie collection app , where i have a page with movie list. I want to add the functionality of filtering the movie based on year, genre and rating and also i want to sort it alphabetically ,year and rating. How can i accomplish that by using redux and react by using single state object.
相关问题
- How to toggle on Order in ReactJS
- Refreshing page gives Cannot GET /page_url in reac
- Adding a timeout to a render function in ReactJS
- React Native Inline style for multiple Text in sin
- Issue with React.PropTypes.func.isRequired
相关文章
- Cannot find module 'redux' 怎么解决?
- Why would we use useEffect without a dependency ar
- Is it possible to get ref of props.children?
- Stateless function components cannot be given refs
- React testing library: Test attribute / prop
- React/JestJS/Enzyme: How to test for ref function?
- Material-UI [v0.x] RaisedButton on hover styles
- Remove expo from react native
First, we should create component to display movies list.
Note, this is a pure stateless component, we are not making sorting or filtering there, just rendering derived props:
Next we will create another stateless component, which will contain sorting and filters view.
Here we are also rendering props, and providing callback to
select
elements:We will store movies and all filtering and sorting data in app state. We need create reducer, to handle sorting and filtering actions:
To provide data to stateless components, we should use
containers
.Let's create
PaneContainer
to provide sorting and filtering data toPane
component:And finally, we will create
MoviesContainer
which will provide visible movies toMovies
component: