Today was all about creating an administrator login to my React.js soundstock.io project. This page will show me any messages left to the developer as well as a visitor counter. Seems simple enough right? I could have taken a few different paths. The more elegant method would be to update the models to allow for an "admin" option in addition to the existing artist and investor options. However, since I'm the only one developing the site I decided to use local storage and state to determine if admin criteria has been met.
My If statement check for a match in local, all that's left to do is query the database and render the page. Using "this.state.message.map()" I'm able to iterate over the array built from the loadMessages() function to render the desired content.
My If statement check for a match in local, all that's left to do is query the database and render the page. Using "this.state.message.map()" I'm able to iterate over the array built from the loadMessages() function to render the desired content.
Comments
Post a Comment