This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './MealPlanItem.css'; | |
const MealPlanItem = (props) => { | |
return( | |
<li> | |
<span className={props.completed && 'meal-striked'} onClick={props.handleMealClick} >{props.title}</span> | |
{props.completed || <button onClick={props.handleDelete}>Delete</button>} | |
</li> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
class App extends Component { | |
render() { | |
return <div>Hello World</div>; | |
} | |
} | |
export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
ReactDOM.render(<App />, document.getElementById('root')); | |
registerServiceWorker(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FETCH_TODOS } from "../actions/types"; | |
export default (state = {}, action) => { | |
switch (action.type) { | |
case FETCH_TODOS: | |
return action.payload; | |
default: | |
return state; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from "redux"; | |
import data from "./dataReducer"; | |
export default combineReducers({ | |
data | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "materialize-css/dist/css/materialize.min.css"; | |
import "materialize-css/dist/js/materialize.min.js"; | |
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import { Provider } from "react-redux"; | |
import { createStore, applyMiddleware } from "redux"; | |
import reduxThunk from "redux-thunk"; | |
import reducers from "./reducers"; | |
import App from "./App"; | |
import registerServiceWorker from "./registerServiceWorker"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as firebase from "firebase"; | |
import { FirebaseConfig } from "../config/keys"; | |
firebase.initializeApp(FirebaseConfig); | |
const databaseRef = firebase.database().ref(); | |
export const todosRef = databaseRef.child("todos"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { todosRef } from "../config/firebase"; | |
import { FETCH_TODOS } from "./types"; | |
export const addToDo = newToDo => async dispatch => { | |
todosRef.push().set(newToDo); | |
}; | |
export const completeToDo = completeToDoId => async dispatch => { | |
todosRef.child(completeToDoId).remove(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (process.env.NODE_ENV === "production") { | |
module.exports = require("./prod"); | |
} else { | |
module.exports = require("./dev"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const FirebaseConfig = { | |
apiKey: "<Web API Key>", | |
authDomain: "<Project ID>.firebaseapp.com", | |
databaseURL: "<Database url>" | |
}; |