These are chat archives for CodeHubOrg/discussions

22nd
May 2017
wingedeel
@wingedeel
May 22 2017 11:58
@all Hi, just doing a small JS excercise. I have a index page which displays a list of items and if I click on one I open a 'details' page. Whats the simplest way of passing the data from the main page to the details page? (just need to pass in name, age etc) Am doing this in vanilla JS and not React.
(would be much easier with React and a single page app)
Katja Durrani
@katjad
May 22 2017 12:31
@wingedeel The simplest way I think would just be to create an object or array inside your script tag (or inside a script that you reference) put it in a variable and read the data from there. That saves you having to do anything asynchronous like reading from filesystem or network request
wingedeel
@wingedeel
May 22 2017 12:36
@katjad. The 'details' page opens up in a separate tab. Would that still work?
Katja Durrani
@katjad
May 22 2017 12:42
@wingedeel If not mistaken, I think the question is more how you get your data. If you can just hardcode them in there, I think it should work.
wingedeel
@wingedeel
May 22 2017 13:02
@katjad Would be great to have a quick look at this tomorrow if possible.
Katja Durrani
@katjad
May 22 2017 13:12
@wingedeel Sure can do that, and more eyes is betetr!
Gicela
@Gicela
May 22 2017 13:50
@wingedeel I think you can use promises, like the example here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
Katja Durrani
@katjad
May 22 2017 16:18
@/all If you have a moment, could you check out http://foul-sage.glitch.me/ Changes in 'About' 'Gettin started' mainly, plus added 'Reference', added subnav that is linking to siblings, and to inpage links (the h2s) - Different styles for mobile. Please be gentle with me (basically spent all night coding), don't immediately dismiss it if it's a bit unconventional ;) "Give it 5 minutes" as the React people say.. Can explain a bit more tomorrow anyway
I've created a pull request if anybody wants to look at the code..
I thought the React meetup was tonight, 22 May now realise it's 22 June, anybody else made that mistake?
Katja Durrani
@katjad
May 22 2017 16:25
@/all Anybody working some more on the site tonight? Content? I might try to do a bit. No more coding for now. - Also, any presentations, @Gicela woudl you be up for more DOM demonstration?
Gicela
@Gicela
May 22 2017 18:44
@katjad Thanks for all your hard work. Maybe a couple of minor points but it is pretty much ready to go :) We should all have a look at it tomorrow.
I also thought the React meetup was tonight. They may have changed the date[?]
Happy to do 15min DOM stuff and continue where we left it.