Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocelots - Megan Maple #136

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import './App.css';
import chatMessages from './data/messages.json';
import ChatLog from './components/ChatLog.js';

const App = () => {
const likeCount = chatMessages.reduce((a, obj) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a clever use of reduce to count

return a + obj.liked;
}, 0);

const updateLikes = () => {
return 0;
};

return (
<div id="App">
<header>
<h1>Application title</h1>
<h2>{likeCount}'❤️'s</h2>
</header>
<main>{<ChatLog entries={chatMessages}></ChatLog>}</main>
<main>
{
<ChatLog
entries={chatMessages}
likeCount={likeCount}
updateLikes={updateLikes}
></ChatLog>
}
</main>
</div>
);
};
Expand Down