Instruction:

To navigate you should use Link component:

import {Link} from 'react-router-dom';

Then you should add link to the render method:

render() {
    console.log(this.props.posts);
    return (
        <div>
            <div className="text-xs-right">
                <Link className="btn btn-primary">
                    Add a post
                </Link>
            </div>
            <h3>Posts</h3>
            <ul className="list-groups">
                {this.renderPosts()}
            </ul>
        </div>
    );
}

And the last thing we need to do, is to specify where we should navigate:

<Link className="btn btn-primary" to="/posts/new">
    Add a post
</Link>

results matching ""

    No results matching ""