Sydnee's Blog


My journey

Redux --- mapDispatchToProps

Understanding the purpose of redux was very complex to understand. I went from building small components in react where each component had it’s very own state, to handling state on a much global level with redux. Redux makes it very easy to share data accross all of your components. All you have to do to retrieve data from the global state is it subcribe or ‘connect’ to the redux store in the specific component where you need that data.


Can you create a sort button

I wrote this blog because for some odd reason, creating buttons and adding event listeners on them was a very challenging aspect for me to learn. Creating the actual button in html was the easy part but adding the event listener and telling your app what to do once the event is fired off, took me a while to master. Here I will show you how I managed to create a sort button while practicing my JavaScript project. This project used a Rails API backend and a Modular JavaScript frontend. The main idea of this project is that users can create posts, delete posts, comment on posts and now like posts. When a new post is created, it appends to the bottom of the page and then users are able to perform functionality. The sort button, once clicked, should sort the posts by ID from the most recent post at top. Here is how I implemented the code: ``` index.html


Learning JavaScript

My journey trying to learn JavaScript has been a very rocky road. I started out thinking every thing would be peaches and cream while I was learning about declaring variables and scope. I understood from day 1, the difference from using let, const,& var when delclaring variables. In JavaScript it is more effecient to declare variables throughout your code with let & const. Variables declared with let CAN be reassigned throughout your code while variables declared with const CANNOT be reassigned. Both of these declarations are block scoped, which means they are only accessible within the block or curly braces in which they are defined. Variables declared with var are not block scoped, which means they are accessible all throughout your code and they also get hoisted to the top. When a variable gets hoisted, it means that no matter where you define this variable, rather at the bottom, the middle, or the top of your code, it can be used before it is declared and can be declared after it is used. For these reasons, the keyword var is not recommended to declare varibales in JavaScript. Some examples of declaring variables are here: ``` var x = 10; // Here x is 10 { let x = 2; // Here x is 2 } // Here x is 10


QueenWorkx

Ruby on Rails means project number 3 for me. Whewwwww!!! It has been a journey. I can say, going and coming out of the Sinatra module a little while back has definitely made my transition into rails a lot easier. I felt sinatra was a breeze for me even though I had to build every function, form, view, model, and controller on my own. It’s something about creating everything by hand and knowing exactly what each function and tag does inside of your project. Rails on the otherhand has many shortcuts and generators that do a lot for you and while it was supposed to make our life easier, it made my life a little harder.


Poetdiary!

This is my first sinatra project here at Flatiron School. I can definitely say it was easier to do than my first CLI project. I say this because I was more comfortable doing this project from scratch with minimal help than I was on the first go round. I chose to do this project on creative writing. I have always liked spoken word and love to just sit at home and write poems about how I am feeling or about something that I was moved by. I created a webapp called Poetdiary where a user can signup/login/signout of their account. While logged in, they are able to create a poem that includes a title, description and some content. A user can not create a poem with NIL values so if attempted, they will be directed to an error page which tells them that a poem can not have NIL values. From there, they are able to go back to their profile and try again. Once they create a valid poem, it will be saved to their profile by it’s title. Each poem that is saved to their profile, they will be able to click it to read, update and even delete their own poem. A user can view another user’s poems but they can not update or delete it. Below I will show you some of the issues I had while creating this project. 1.My first issue was that my user was not able to signup or login to my webapp. To fix this, I had to install the ‘bcrypt’ gem. AKA ‘add it to my gemfile then run bundle install’ ``` source ‘http://rubygems.org’