diff --git a/.env b/.env new file mode 100644 index 00000000..7d910f14 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SKIP_PREFLIGHT_CHECK=true \ No newline at end of file diff --git a/src/components/MovieHeader.js b/src/components/MovieHeader.js index e3443e5f..fc77d0a3 100644 --- a/src/components/MovieHeader.js +++ b/src/components/MovieHeader.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'react-router-dom'; - +import { connect } from 'react-redux'; const MovieHeader = (props) => { const appTitle = ""; const displayFavorites = true; @@ -18,5 +18,11 @@ const MovieHeader = (props) => { ); } +const mapStateToProps = (state) => { + return { + appTitle: state.appTitle + + } +} -export default MovieHeader; \ No newline at end of file +export default connect(mapStateToProps, {})(MovieHeader); \ No newline at end of file diff --git a/src/components/MovieList.js b/src/components/MovieList.js index 268c7809..013f5a24 100644 --- a/src/components/MovieList.js +++ b/src/components/MovieList.js @@ -1,9 +1,9 @@ import React from 'react'; - +import { connect } from 'react-redux'; import MovieListItem from './MovieListItem'; import MovieFooter from './MovieFooter'; -const MovieList = (props)=> { +const MovieList = props => { const movies = []; return ( @@ -30,5 +30,10 @@ const MovieList = (props)=> { ); } +const mapStateToProps = state =>{ + return { + movies: state.movies + } +} -export default MovieList; \ No newline at end of file +export default connect(mapStateToProps, {})(MovieList); \ No newline at end of file diff --git a/src/index.js b/src/index.js index dfc70e99..05da0153 100644 --- a/src/index.js +++ b/src/index.js @@ -9,9 +9,13 @@ import App from './App' import { BrowserRouter as Router } from 'react-router-dom'; import './index.css'; +const store = createStore(reducer); + ReactDOM.render( - - - , + + + + + , document.getElementById('root') ); diff --git a/src/reducers/movieReducer.js b/src/reducers/movieReducer.js index 16f33bcd..5c061e56 100644 --- a/src/reducers/movieReducer.js +++ b/src/reducers/movieReducer.js @@ -6,7 +6,7 @@ const initialState = { appTitle: "IMDB Movie Database" } -const reducer = (state, action) => { +const reducer = (state = initialState, action) => { switch(action.type) { case DELETE_MOVIE: return {