Nicholas Galante has extensive work experience in marketing, growth, and media. Nicholas began their career in 2005 as a Senior Media Buyer at Vertrue. In 2010, they moved on to become a Digital Media Analyst at Number 9. From 2011 to 2013, they worked as Director of Marketing for a confidential client, where they developed and implemented global branding and growth strategies for US, UK, China, and Eastern European markets. Finally, from 2013 to present, they have held various roles at Direct Agents, including VP Growth, eCommerce, VP of Growth, and Director of Media.
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { fetchPost, deletePost } from '../actions';
class PostsShow extends Component {
componentDidMount() {
// provided by react-router
const { id } = this.props.match.params;
this.props.fetchPost(id);
}
onDeleteClick() {
const { id } = this.props.match.params;
this.props.deletePost(id, () => {
this.props.history.push('/');
});
}
render() {
const { post } = this.props;
if (!post) {
return <div>Loading...</div>;
}
return (
<div>
<Link to="/">Back To Index</Link>
<button
className="btn btn-danger pull-xs-right"
onClick={this.onDeleteClick.bind(this)}
>
Delete Post
</button>
<h3>{post.title}</h3>
<h6>Categories: {post.categories}</h6>
<p>{post.content}</p>
</div>
);
}
}
// ownProps is the props object that is headed to the component
// above. It contains the id from the url.
function mapStateToProps({ posts }, ownProps) {
return { post: posts[ownProps.match.params.id] };
}
export default connect(mapStateToProps, { fetchPost, deletePost })(PostsShow);
Links
Sign up to view 4 direct reports
Get started