From 8ea1b415d5c288908d687e6ee8d0c275089b1039 Mon Sep 17 00:00:00 2001 From: Renard Date: Thu, 12 Sep 2019 00:24:37 -0300 Subject: Fix: Imagenes y componentUpdate --- src/Board.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src/Board.js') diff --git a/src/Board.js b/src/Board.js index 759079b..5a4e620 100644 --- a/src/Board.js +++ b/src/Board.js @@ -1,5 +1,5 @@ import React, { Component } from "react"; -import { Loader, Message, Segment, Header } from "semantic-ui-react"; +import { Loader, Message, Segment, Header, Icon, Image } from "semantic-ui-react"; import { Link } from "@reach/router"; import Moment from "react-moment"; import "moment/locale/es"; @@ -27,6 +27,22 @@ class Board extends Component { .catch(console.error) } + componentWillUnmount() { + console.log("will unmount") + } + + componentDidUpdate(prevProps) { + // Uso tipico (no olvides de comparar los props): + if (this.props.dir !== prevProps.dir) { + this.setState({ + isLoaded: false, + threadList: [], + error: null + }) + this.componentDidMount(); + } + } + render() { const { isLoaded, error, threadList } = this.state; @@ -63,9 +79,14 @@ class Board extends Component {
{thread.replies.map(reply => -