This file contains 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 './index.css'; | |
import App from './App'; | |
ReactDOM.render( | |
<App />,document.getElementById('root')); |
This file contains 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 className="App"> | |
<h1>Hello React!</h1> | |
</div> | |
); | |
} |
This file contains 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'; | |
import PostForm from './PostForm'; | |
import AllPost from './AllPost'; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<PostForm /> |
This file contains 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 PostForm extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>Create Post</h1> | |
<form> | |
<input required type="text" placeholder="Enter Post Title" /><br /><br /> | |
<textarea required rows="5" cols="28" placeholder="Enter Post" /><br /><br /> |
This file contains 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 AllPost extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>All Posts</h1> | |
</div> | |
); | |
} |
This file contains 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 './index.css'; | |
import App from './App'; | |
import { createStore } from 'redux'; | |
import postReducer from './reducers/postReducer'; | |
const store = createStore(postReducer); | |
ReactDOM.render(<App />,document.getElementById('root')); |
This file contains 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
const postReducer = (state = [], action) => { | |
} | |
export default postReducer; |
This file contains 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
const postReducer = (state = [], action) => { | |
switch(action.type) { | |
case 'ADD_POST': | |
return state.concat([action.data]); | |
default: | |
return state; | |
} | |
} | |
export default postReducer; |
This file contains 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 PostForm extends Component { | |
handleSubmit = (e) => { | |
e.preventDefault(); | |
const title = this.getTitle.value; | |
const message = this.getMessage.value; | |
const data = { | |
id: new Date(), | |
title, |
This file contains 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 PostForm extends Component { | |
handleSubmit = (e) => { | |
e.preventDefault(); | |
const title = this.getTitle.value; | |
const message = this.getMessage.value; | |
const data = { | |
id: new Date(), | |
title, |