scrimba
Frontend Career Path
Essential JavaScript concepts
Twitter Clone
Render the tweets to the feed
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Render the tweets to the feed
AboutCommentsNotes
Render the tweets to the feed
Expand for more info
index.js
run
preview
console
import { tweetsData } from './data.js'
const tweetInput = document.getElementById('tweet-input')
const tweetBtn = document.getElementById('tweet-btn')

tweetBtn.addEventListener('click', function(){
console.log(tweetInput.value)
})

function getFeedHtml(){

let feedHtml = ``

tweetsData.forEach(function(tweet){
feedHtml += `
<div class="tweet">
<div class="tweet-inner">
<img src="${tweet.profilePic}" class="profile-pic">
<div>
<p class="handle">${tweet.handle}</p>
<p class="tweet-text">${tweet.tweetText}</p>
<div class="tweet-details">
<span class="tweet-detail">
${tweet.replies.length}
</span>
<span class="tweet-detail">
${tweet.likes}
</span>
<span class="tweet-detail">
${tweet.retweets}
</span>
</div>
</div>
</div>
</div>
`
})
return feedHtml
}



Console
/index.html
-3:58