diff --git a/blog/src/components/posts_index.js b/blog/src/components/posts_index.js index f8d6c264..51170975 100644 --- a/blog/src/components/posts_index.js +++ b/blog/src/components/posts_index.js @@ -1,4 +1,4 @@ -import _ from "lodash"; +//import _ from "lodash"; import React, { Component } from "react"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; @@ -10,7 +10,8 @@ class PostsIndex extends Component { } renderPosts() { - return _.map(this.props.posts, post => { + //return _.map(this.props.posts, post => { + return Object.values(this.props.posts).map(post => { // my version without lodash return (
  • @@ -21,6 +22,8 @@ class PostsIndex extends Component { }); } + + render() { return (
    diff --git a/blog/src/components/posts_new.js b/blog/src/components/posts_new.js index ce9bd401..a8333788 100644 --- a/blog/src/components/posts_new.js +++ b/blog/src/components/posts_new.js @@ -7,27 +7,32 @@ import { createPost } from "../actions"; class PostsNew extends Component { renderField(field) { const { meta: { touched, error } } = field; + /* destructuring ES6 (the line above is the same as this below) + const touched = field.meta.touched; + const error = field.meta.error;*/ + const className = `form-group ${touched && error ? "has-danger" : ""}`; - - return ( + + + let customField = !field.texarea ? :