The purpose of this project is to continue building on your knowledge of React that was started with the React I project. Here, you'll be implementing a lot of the same concepts and structuring your components in a very similar fashion. The main difference this time around is that you'll be using the create-react-app utility to generate your React project for you. Don't worry about all of the extra files that you may not understand are present inside the created React application. The overall structure of the project remains exactly the same as what you worked with in React I.
For this project, you'll be building a simple Instagram clone using React. There is a provided file called dummy-data.js that contains some mock data. Each object in the mock data represents a faux Instagram post. Your React application will receive this faux post data and render each as a separate Instagram post.
By the end of this project, you should be comfortable with what components are, the notion of state within a component, as well as passing data from a parent component down to a child component.
Try to get all of the tests passing. If you don't get there, then aim for creating all of the different components and organizing them appropriately in terms of the parent-child relationship, with data getting passed around accordingly.
- Run
npm i -g create-react-appto install the React app generator globally. - Run
create-react-app instagramto create your starter application with the nameinstagram. - Once your React project has been created, move the provided
/testsdirectory as well as thedummy-data.jsfile into the/srcdirectory of your newly-generated React project. - Inside your
instagramproject directory, runnpm i --save enzyme sinon enzyme-adapter-react-16, which will install additional necessary dependencies thatcreate-react-appdoesn't install for you off the bat. - Create a
componentsdirectory inside thesrcdirectory, and then create a directory calledSearchBar, another one calledPostContainer, and lastly one calledCommentSection, all inside thesrcdirectory. Each of these directories should contain the component file as well as the CSS for their respective components.
- There are three components that you'll need to implement for this project: the Search Bar, the Post Container, and the Comment Section.
- In your completed project, there will be a single instance of the Search Bar being rendered at the top of the page, as well as a Post Container and a Comment Section for every piece of mock data in the
dummy-data.jsfile. - The root App component of your application should import the dummy data from the
dummy-data.jsfile withimport dummyData from './dummy-data';and iterate over said data, passing each individual object as a prop to an instance ofPostContainer. - Each
PostContainercomponent will then pass the array of comments on each post object as a prop to an instance of theCommentSectioncomponent. - The
CommentSectioncomponent will receive the array of comments as props and render each one with the username of the poster as well as the post's text. Additionally, there should be an input box that allows users to submit a new comment for any post. Since there is no login page or anything of that sort, hard code a static username. - You are free to leverage the Bootstrap library for this project for the purposes of theming and styling. I recommend the awesome react-bootstrap library, which is a library of Bootstrap components that have been implemented using React, so they're really easy to just drop straight into React projects.
- In addition to Bootstrap for theming, you'll want to add your own styles via CSS. To keep things organized, have the CSS file that corresponds with a component live in the same directory as the component file.
Your search bar should look something like this:

Your post container should look something like this:

- Implement the ability to like a post by clicking on a heart icon and having the number of likes increment accordingly.
- Get the Search Bar to filter posts by the post's username. When you submit a search term should filter out posts by users whose usernames do not match the search term.
- Look into the moment.js library to read about how to dynamically format the timestamp into a human-readable format like how it is being displayed in the screenshot.