state = { posts: {} };
async componentDidMount () {
await database.on('value', (snap) => {
this.setState({ posts: snap.val() });
});
}
renderPosts = () => {
if (this.state.posts !== null) {
const posts = this.state.posts;
return Object.keys(posts).map((key) => (
<div key={key}>
<h2>{posts[key].title}</h2>
<p>{posts[key].body}</p>
</div>
));
}
};
“No problem can be solved from the same level of consciousness that created it.” Albert Einstein (1879-1955)
Subscribe to:
Post Comments (Atom)
Create modal using HTML and CSS
<body> <dialog id = "modal"> <div> <h1>Title</h1> <p>Sample Text</p...
-
//convert BASE64 string to Byte{} array function base64ToArrayBuffer(base64) { var binaryString = window.atob(base64); var binar...
-
<asp:UpdatePanel runat="server"> <ContentTemplate> Employee : <asp:ListBox ID="lstEmployee" r...
-
# Run PowerShell as Administrator Install-Module -Name UniversalDashboard.Community # Check PowerShellGet version Get-Module -Name PowerShel...
No comments:
Post a Comment