File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2,26 +2,28 @@ import React from 'react';
22import { useGlobalContext } from './Context' ;
33
44const PopularNews = ( ) => {
5- const { isLoading, popularNews } = useGlobalContext ( ) ;
5+ const { isLoading, popularNews } = useGlobalContext ( ) ;
66
77 if ( isLoading ) {
88 return < p > Loading popular news...</ p > ;
99 }
1010
1111 return (
12- < div className = ' popular-news-section' >
12+ < div className = " popular-news-section" >
1313 < h2 > 🔥 Trending Tech News</ h2 >
14- { popularNews . length > 0 && (
14+ { popularNews . length > 0 ? (
1515 < ul >
1616 { popularNews . map ( ( news ) => (
17- < li key = { news . objectID } >
17+ < li key = { news . objectID } className = "news-item" >
1818 < a href = { news . url } target = "_blank" rel = "noopener noreferrer" >
1919 { news . title }
2020 </ a >
2121 < span className = "badge" > 💬 { news . num_comments || 0 } comments</ span >
2222 </ li >
2323 ) ) }
2424 </ ul >
25+ ) : (
26+ < p > No popular news available.</ p >
2527 ) }
2628 </ div >
2729 ) ;
You can’t perform that action at this time.
0 commit comments