These are chat archives for FreeCodeCamp/Help

26th
Jan 2018
LydaTech
@lydatech
Jan 26 2018 03:54
cha-ching
Eric Miller
@ericmiller777
Jan 26 2018 05:10
Redux is weird/confusing
Claudio Restifo
@Marmiz
Jan 26 2018 05:16
@ericmiller777 it's mainly verbose. But makes sense.
The whole point of Redux is to actually make sense.
I'm just glad that at work we reduced the number of redux line drastically since we switched to GraphQL <3 <3 <3
Kyle Holm
@thekholm80
Jan 26 2018 05:24
<3 Redux and GraphQL, but haven't tried them together yet (only made GraphQL servers so far)
Eric Miller
@ericmiller777
Jan 26 2018 05:25
const defaultState = {
  login: false
};

const reducer = (state = defaultState, action) => {
  // change code below this line
  if (action.type == "LOGIN"){
    return state = {login: true};
  }else{
    return state;
  };
  // change code above this line
};

const store = Redux.createStore(reducer);

const loginAction = () => {
  return {
    type: 'LOGIN'
  }
};
I kinda undertsand it
but how am i able to call action.type
maybe its just this challenge
because when is loginAction called
and how does reducer know it was called
guess i just started
should probably keep going
Kyle Holm
@thekholm80
Jan 26 2018 05:28
@ericmiller777 there are some decent diagrams reactjs/redux#653 that explain the redux flow
i really like this one
Eric Miller
@ericmiller777
Jan 26 2018 05:30
@thekholm80 @Marmiz thanks
CamperBot
@camperbot
Jan 26 2018 05:30
ericmiller777 sends brownie points to @thekholm80 and @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1133 | @marmiz |http://www.freecodecamp.org/marmiz
:star2: 1674 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Claudio Restifo
@Marmiz
Jan 26 2018 05:31
@ericmiller777 your loginAction returns an object, so you are able to access it inside the reducer function
Eric Miller
@ericmiller777
Jan 26 2018 05:31
from the next challenge i see that everytime a action happends it calls the reducer?
Claudio Restifo
@Marmiz
Jan 26 2018 05:31
@ericmiller777 well, reducer will pick up every action "shipped" with dispatch
Kyle Holm
@thekholm80
Jan 26 2018 05:32
that's why we put a type in there, so it knows what to do with the action
Eric Miller
@ericmiller777
Jan 26 2018 05:32
"This is important because once your app has multiple reducers, they are all run any time an action dispatch is made, even when the action isn't related to that reducer. In such a case, you want to make sure that you return the current state."
hmm i see, just gotta keep going I guess
Kyle Holm
@thekholm80
Jan 26 2018 05:33
Redux broke my brain for like 2 weeks, but once you get the hang of it it's really awesome
just keep at it
Claudio Restifo
@Marmiz
Jan 26 2018 05:33
@ericmiller777 are you already familiar with react?
and by familiar I mean proficient. Otherwise there's no really a point of learning redux (or mobx or any other state manager) imho.
it just confuses things, slowing your understanding of react
Eric Miller
@ericmiller777
Jan 26 2018 05:37
@Marmiz yea, im just okay with react, im just doing the challeges. ive done like 3 react tutorials now but i still wouldnt call myself "proficient" at least not like I would say I am at javascript
Claudio Restifo
@Marmiz
Jan 26 2018 05:37

p.s. this is probably the best resource so far to learn redux:
https://egghead.io/courses/getting-started-with-redux

(the author is the same guy who created redux)

Eric Miller
@ericmiller777
Jan 26 2018 05:38
weird ill probably do some of the react challenges, do that tutorial, then try and incorportate redux in the last few
Claudio Restifo
@Marmiz
Jan 26 2018 05:39

@ericmiller777 my critique is that I saw sooooooo many people jumping on redux and they don't even know how to write a parent/child communication pattern in plain react.

or a HOC.

I think that one of the main thing to understand about redux is: When redux is actually useful, and when is just a liability :)
Eric Miller
@ericmiller777
Jan 26 2018 05:40
yea, i'm probably somewhere in between, I could use more react experience
Claudio Restifo
@Marmiz
Jan 26 2018 05:42

@ericmiller777 quoting Redux docs:

Some UI libraries (like React) have their own state management system. If you are using one of these libraries, especially if you are just learning to use them, we encourage you to learn the capabilities of that built-in system first. It might be all you need to build your application. If your application becomes so complex that you are confused about where state is stored or how state changes, then it is a good time to learn Redux. Experiencing the complexity that Redux seeks to abstract is the best preparation for effectively applying that abstraction to your work.

Eric Miller
@ericmiller777
Jan 26 2018 05:43
@Marmiz thanks
CamperBot
@camperbot
Jan 26 2018 05:43
ericmiller777 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
api offline
Claudio Restifo
@Marmiz
Jan 26 2018 05:45
those are just my 2c anyway... treat them like so :+1:
Eric Miller
@ericmiller777
Jan 26 2018 05:50
@Marmiz no no i understand
Pieter Stokkink
@forkerino
Jan 26 2018 07:01
Save yourself hours of writing boilerplate and write some Redux snippets. (Once you are comfortable with it, obviously. Until that time keep banging your keyboard)
Darren
@DarrenfJ
Jan 26 2018 07:31
evening fCC
Claudio Restifo
@Marmiz
Jan 26 2018 08:03
@DarrenfJ :wave:
Anirban Mukherjee
@bwayne2015
Jan 26 2018 08:14
@bwayne2015
hello can anyone help a newbie on a hapi js issue
I want to know how can I show users specific data
I mean to say if user A has a data data1 and user B has a data as data2 then when user A logs in how should verify user A's username and show only data1 not data2 and similarly for B will show only data2 and not data1. But when Admin will log in then Admin will be able to see both the datas.
Anirban Mukherjee
@bwayne2015
Jan 26 2018 08:20
thanks in advance
Bjorn van de Peut
@bjorno43
Jan 26 2018 08:44
@DarrenfJ Hey. Could let me know when you can spare me like 30 mins? There's something I'd like to talk to you about privately :)
Darren
@DarrenfJ
Jan 26 2018 09:01
@bjorno43 sorry, stepped away for a second to watch some vids
hit me up in PM if yer still around
Darren
@DarrenfJ
Jan 26 2018 09:07
probably gonna sneak off to bed in a bit though
Bjorn van de Peut
@bjorno43
Jan 26 2018 09:08
I'm still here
Sorry, was on the phone for a few mins
I'll hit ya a pm
Jill Lee
@jill-lee
Jan 26 2018 09:31
@daddycardona sorry just got back. I'm not on any challenge just practicing and learning it works for me. :) thanks
CamperBot
@camperbot
Jan 26 2018 09:31
phoenix-burn sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 517 | @daddycardona |http://www.freecodecamp.org/daddycardona
Darren
@DarrenfJ
Jan 26 2018 09:32
@phoenix-burn Jill! havne't seen you around on forever!
how goes the jewelry site?
Darren
@DarrenfJ
Jan 26 2018 09:52
heading to bed.. later roomies
DarrenfJ @DarrenfJ sneaks off to bed
Ken Haduch
@khaduch
Jan 26 2018 14:19
good day to all freeCodeCampers!
Kyle Holm
@thekholm80
Jan 26 2018 14:19
@khaduch good morning Ken
Ken Haduch
@khaduch
Jan 26 2018 14:20
hello @thekholm80 ! How are things going? It seems to be pretty quiet here...
Kyle Holm
@thekholm80
Jan 26 2018 14:21
pretty good here. It's Friday & I don't seem to have any big fires to put out. Looking forward to a nice, quiet day
you?
LydaTech
@lydatech
Jan 26 2018 14:22
Good morning
Kyle Holm
@thekholm80
Jan 26 2018 14:24
@lydatech :wave:
LydaTech
@lydatech
Jan 26 2018 14:24
@thekholm80 :wave: just looking at your site. Clean. I like it
Kyle Holm
@thekholm80
Jan 26 2018 14:24
@lydatech which site?
Kyle Holm
@thekholm80
Jan 26 2018 14:25
oh! I forgot about that lol
it will be offline in a few weeks lol, I had fun with it at first but I have a short attention span
@lydatech thanks for the kudos though
CamperBot
@camperbot
Jan 26 2018 14:26
thekholm80 sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 2624 | @lydatech |http://www.freecodecamp.org/lydatech
LydaTech
@lydatech
Jan 26 2018 14:27
@thekholm80 With so many sites pushing the envelope now a days its nice to find one that is easy to navigate. Gotta love WP
Kyle Holm
@thekholm80
Jan 26 2018 14:28
yeah
I highly recommend WP for anyone that doesn't want to learn web dev, but just wants to put out some content
LydaTech
@lydatech
Jan 26 2018 14:30
I do a lot of WP dev. It pays the bills
Kyle Holm
@thekholm80
Jan 26 2018 14:32
I briefly considered it, but thought maybe I should get better with JS and all that before moving on to PHP
Alvin Meng
@alvinmeng1993
Jan 26 2018 14:34
hi
Kyle Holm
@thekholm80
Jan 26 2018 14:35
@alvinmeng1993 hello
Alvin Meng
@alvinmeng1993
Jan 26 2018 14:35
how to put <h1> or <p> in center?
hi kyle
when wrriting html ,how to make <h> and <p> in page center ?
Kyle Holm
@thekholm80
Jan 26 2018 14:38
the simplest way, in css would be h1, p { text-align: center; }
LydaTech
@lydatech
Jan 26 2018 14:38
@alvinmeng1993 2 main ways text-align: center or margin: 0 auto; depending on the context
Alvin Meng
@alvinmeng1993
Jan 26 2018 14:39
thans ...
Ken Haduch
@khaduch
Jan 26 2018 15:08
@thekholm80 - a busy weekend ahead! Family visitors from out of town, baptism of our granddaughter, lots of running and things to do for keeping everyone entertained / prepared... should be good but busy! A really whirlwind week that just finished and more ahead... maybe coding sometime next week... :)
Kyle Holm
@thekholm80
Jan 26 2018 15:08
the code will be there when real life quiets down
Ken Haduch
@khaduch
Jan 26 2018 15:09
yes, but I get rusty so quickly! :)
Kyle Holm
@thekholm80
Jan 26 2018 15:09
oh man, me too
trying to get back up to speed is a pain sometimes
Kaz Baig
@kbaig
Jan 26 2018 15:14
:wave:
Kyle Holm
@thekholm80
Jan 26 2018 15:14
@kbaig good morning
Kaz Baig
@kbaig
Jan 26 2018 15:14
:fire: Friday :fire:
Had two 7 pm work days in a row, let's hope today isn't a third
Kyle Holm
@thekholm80
Jan 26 2018 15:15
eww
Ken Haduch
@khaduch
Jan 26 2018 15:15
@kbaig - howdy!
Kyle Holm
@thekholm80
Jan 26 2018 15:16
I guess technically my work day never ends, but I shut down my work PC at 3:30 most days
Kaz Baig
@kbaig
Jan 26 2018 15:16
That's nice
Depends on when you start though doesn't it
Kyle Holm
@thekholm80
Jan 26 2018 15:16
7 am
the joys of the rest of my team being 2 time zones east of me
Kaz Baig
@kbaig
Jan 26 2018 15:20
Ahh gotcha gotcha
Vikash Saini
@Enigma10
Jan 26 2018 16:52
hello, anyone active here
Kyle Holm
@thekholm80
Jan 26 2018 16:56
@Enigma10 folks are in and out all day
what's up?
Vikash Saini
@Enigma10
Jan 26 2018 16:57
@thekholm80 i want to ask question related to interview task

@thekholm80 We would like you to create a basic photo managing web-app that allows users to upload and delete photos and select one to be their profile picture. There should be a backend for image persistence.

Required features:

User can upload an image
User can delete an uploaded image
User can select an uploaded image to be their profile picture
User can view their uploaded images and their avatar, even after refreshing the page

You can use any technology or framework for this project, though we strongly prefer a React.js frontend and a Node.js backend, as these are technologies that we use. Your frontend should use at least some Javascript, i.e. you should not just rely on server rendered static HTML and elements. Assume the code you are writing would be going into production - make it clean, modular, and add comments where appropriate.
```

I need to have database for this.

Kyle Holm
@thekholm80
Jan 26 2018 16:59
i think a database would be the easiest way to get the persistence they're asking for
Vikash Saini
@Enigma10
Jan 26 2018 16:59
okay thanks mate @thekholm80
CamperBot
@camperbot
Jan 26 2018 16:59
enigma10 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1675 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Kyle Holm
@thekholm80
Jan 26 2018 17:00
well ... for actual storing of the files you'd probably just have a directory on your server (the back end) for the images, then reference them in your database to make finding / retrieving easier
Vikash Saini
@Enigma10
Jan 26 2018 17:01
@thekholm80 yeah that's why i am little confused
@thekholm80 I know one library multr which is used to upload file to server
Kyle Holm
@thekholm80
Jan 26 2018 17:02
multer is pretty awesome
Vikash Saini
@Enigma10
Jan 26 2018 17:03
so it is possible to use multer , express and react
Kyle Holm
@thekholm80
Jan 26 2018 17:03
absolutely
Vikash Saini
@Enigma10
Jan 26 2018 17:03
:confused:
Kyle Holm
@thekholm80
Jan 26 2018 17:03
i'd suggest mongodb as a database as well
Vikash Saini
@Enigma10
Jan 26 2018 17:03
okay thanks mate
Kyle Holm
@thekholm80
Jan 26 2018 17:04
if you get stuck someone's usually here to help out
Vikash Saini
@Enigma10
Jan 26 2018 17:07
yeah community is very big here. i used to come here.
Kyle Holm
@thekholm80
Jan 26 2018 17:08
we also have a room just for back end stuff, folks who know more about node/express/mongodb and the related packages
Darren
@DarrenfJ
Jan 26 2018 18:09
morning fCC
@khaduch sounds like yer weekend is booked!
Darren
@DarrenfJ
Jan 26 2018 18:15
I think some of the regulars might like the inherent comedic value of this: http://ponzicoin.co/home.html
apparently he had to lock it down cause people were taking it seriously
and finally, if any newbies want to get some git experience, @RomchyFCC set up a repo to fork, add you name to the list and do a PR.. the very basics... we're hoping to make it into more of an interactive tutorial in the very very faaaaaar future...
Kaz Baig
@kbaig
Jan 26 2018 18:24

@DarrenfJ

We suggest shilling this coin heavily to your family and friends like a fucking sociopath. Creating posts on how this coin will 1000x by April on /r/wallstreetbets, /r/cryptocurrency, /biz/, and making several youtube videos promoting PonziCoin is also encouraged.

hmmm
It's a bold strategy Cotton
PonziCoin tokens (symbol: SEC)
lmfao
Darren
@DarrenfJ
Jan 26 2018 18:33
I love the white paper too
Kaz Baig
@kbaig
Jan 26 2018 18:34
solid visuals
Darren
@DarrenfJ
Jan 26 2018 18:37
thought you might like it lol
ok back to my corner of the world where i just test all day
Kaz Baig
@kbaig
Jan 26 2018 18:37
It's making its way around the office now
DarrenfJ @DarrenfJ sighs
JuliaXi
@JuliaXi
Jan 26 2018 19:08

<style>
.red-text {
color: red;
}
p,p1{font-size:16px;}
</style>

<h2 class="red-text">我家的猫咪</h2>

<p class="red-text">在大家心目中,猫是慵懒的可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>

<p1>养动物有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,狗狗和猫猫会到处拉屎,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,狗猫慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p1>

can anyone tell me the faults in these code?
ehutchllew
@ehutchllew
Jan 26 2018 19:10
woah
@JuliaXi what isit not doing?
@JuliaXi get rid of <p1> and replace with <p> or <h1>
JuliaXi
@JuliaXi
Jan 26 2018 19:11
they are two p
haha
ehutchllew
@ehutchllew
Jan 26 2018 19:12
@JuliaXi <p1> is not an element
@JuliaXi if you want to differentiate you can use id and class attributes
JuliaXi
@JuliaXi
Jan 26 2018 19:18
@ehutchllew thank you so much,i tried your suggestion,and it worked.thank you so much!
CamperBot
@camperbot
Jan 26 2018 19:18
juliaxi sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
:cookie: 370 | @ehutchllew |http://www.freecodecamp.org/ehutchllew
ehutchllew
@ehutchllew
Jan 26 2018 19:24
@JuliaXi no problem :)