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 {firebase_board_list} from './App_reducer'; | |
| class BoardList extends Component { | |
| componentDidMount() { | |
| this.props.dispatch(firebase_board_list()); | |
| } | |
| render() { | |
| const { boards} = this.props; |
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 firebase_board_list = () =>{ | |
| return (dispatch) => { | |
| return firestore.collection("boards").orderBy("brddate", "desc") | |
| .onSnapshot(function(snapshot) { | |
| snapshot.docChanges().forEach(function(change) { | |
| var childData = change.doc.data(); | |
| if (change.type === "added") { | |
| childData.brddate = dateFormat(childData.brddate, "yyyy-mm-dd"); | |
| dispatch(board_save(childData)); | |
| } else |
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 { createAction, handleActions } from 'redux-actions'; | |
| import firestore from './Firestore'; | |
| ~~ 생략 ~~ | |
| export const firebase_board_list = () =>{ | |
| return (dispatch) => { | |
| return firestore.collection('boards').orderBy("brddate", "desc").get() | |
| .then((snapshot) => { | |
| var rows = []; | |
| snapshot.forEach((doc) => { |
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'; | |
| import { connect } from 'react-redux'; | |
| import { board_read, board_remove } from './App_reducer' | |
| class BoardItem extends Component { | |
| handleUpdateForm = (brdno) => { | |
| this.props.dispatch(board_read(brdno)); | |
| } | |
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'; | |
| import { connect } from 'react-redux'; | |
| import { board_save } from './App_reducer' | |
| class BoardForm extends Component { | |
| state = {}; | |
| initialSelectedBoard = { | |
| brdno: "", | |
| brdtitle: "", |
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'; | |
| import { connect } from 'react-redux'; | |
| import BoardForm from './App_BoardForm'; | |
| import BoardItem from './App_BoardItem'; | |
| class App extends Component { | |
| render() { | |
| const { boards} = this.props; |
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
| const BOARD_SAVE = 'SAVE'; | |
| const BOARD_REMOVE = 'REMOVE'; | |
| const BOARD_READ = 'ONE'; | |
| const BOARD_LIST = 'LIST'; | |
| export const board_save = (data) => ({ | |
| type: BOARD_SAVE, | |
| 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 React, { Component } from 'react'; | |
| class BoardForm extends Component { | |
| shouldComponentUpdate(nextProps, nextState) { | |
| let selectedBoard = nextProps.selectedBoard; | |
| if (!selectedBoard.brdno) { | |
| this.brdtitle.value = ""; | |
| this.brdwriter.value = ""; | |
| return true; |
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
| class App5 extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.child = React.createRef(); | |
| } | |
| ~~ 생략 ~~ | |
| handleSaveData = (data) => { | |
| let boards = this.state.boards; |
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
| class App5 extends Component { | |
| ~~ 생략 ~~ | |
| handleRemove = (brdno) => { | |
| this.setState({ | |
| boards: this.state.boards.filter(row => row.brdno !== brdno) | |
| }) | |
| } | |
| ~~ 생략 ~~ | |
| render() { |
NewerOlder