30 lines
854 B
JavaScript
30 lines
854 B
JavaScript
'use client';
|
|
import { useState } from 'react';
|
|
|
|
const blurb_data = {
|
|
title: "Fart Man Comes To Town!",
|
|
blurb: "Will this controversial figure finally cause the downfall of the town? Sally Smith from town center says that she can already smell trouble brewing but other members of the town believe the imminent winds of change will revitalize the towns central business district."
|
|
};
|
|
|
|
function Blurb({ title, blurb }) {
|
|
return (<div>
|
|
<h1>{ title }</h1>
|
|
<p>{ blurb }</p>
|
|
<a href="#">Read more...</a>
|
|
</div>);
|
|
}
|
|
|
|
export default function HomePage() {
|
|
const [blurbs, setBlurbs] = useState([ blurb_data ])
|
|
function addBlurb() {
|
|
setBlurbs(blurbs.concat([blurb_data]));
|
|
}
|
|
return (<>
|
|
{blurbs.map((blurb, i) => (
|
|
<Blurb key={i} {...blurb} />
|
|
))}
|
|
<br />
|
|
<button onClick={addBlurb}>Load More</button>
|
|
</>);
|
|
}
|