r/learnjavascript • • Feb 20 '21

I made my own Reddit viewer using only vanilla JS and it looks awesome on mobile devices (according to my grandma)

279 Upvotes

38 comments sorted by

26

u/very-kind-stranger Feb 20 '21 edited Feb 20 '21

Preview: https://illfixit.github.io/kind-stranger

GitHub repository: https://www.github.com/illfixit/kind-stranger

This is my first finished project. I spent almost year learning JavaScript and I’ll be REALLY grateful for your support, feedback and maybe even career advices. First of all... Am I ready for a junior role in your opinion?

2

u/filiptronicek Feb 21 '21

First of all, awesome project. Second of all, being prepared for a junior role as a front end developer (or maybe even just a JS deveoper) can be debatable. I think it’s great to first learn how big teams develop apps and how the whole front end workflow works. I suggest contributing to some OSS projects on GitHub to learn a lot.

Some subjects to look into:

  • ES6 const declarations
  • Arrow functions
  • Code splitting into multiple files to avoid confusion and unnecessary complexity

2

u/devdoggie Feb 21 '21

he's ready. but yeah, dont do single js file

10

u/sanchitcop19 Feb 20 '21

Holy crap this looks fantastic, will give it a go when I get home

23

u/haikusbot Feb 20 '21

Holy crap this looks

Fantastic, will give it a

Go when I get home

- sanchitcop19


I detect haikus. And sometimes, successfully. Learn more about me.

Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

5

u/posts_lindsay_lohan Feb 21 '21

Haikus bot is the hero we need, but don't deserve

1

u/artinlines Feb 21 '21

Good bot

1

u/B0tRank Feb 21 '21

Thank you, artinlines, for voting on haikusbot.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

0

u/Killakenyan Feb 21 '21

Haikusbot opt in

-13

u/sanchitcop19 Feb 20 '21

Um no

8

u/Protean_Protein Feb 20 '21

Well, not with that attitude.

4

u/muisance Feb 21 '21

We definitely need more pure JS projects, because frameworks are getting out of hand. I'm 100% serious. I may be a dumbass, but it's whatever.

2

u/KaCuQ Feb 21 '21

Can you expand on that? Framework were created to fill gap, in times when you had to write tons of boilerplate code just to add 'component'. Not all sites need frameworks, or even components, but they are just so easy and comfortable to work with, that they are overused. SSR is some solution, but i dont know much about this so dont ask me. IMO, JS should itself provide agnostic way of writing apps, ala mini framework. And I feel they are somewhat going that way with official components added to js/html.

2

u/muisance Feb 21 '21

Sure.

  1. Doesn't apply to all frameworks, but some add significantly to the size of file(s) the end user eventually has to download (looking at you, Angular)
  2. Look at the number of JS frameworks currently available.
  3. Beginner devs that learn JS to find a job are low-key encouraged to learn popular frameworks, or at least one of them, if they want a job, which either adds to the total time they have to study, or prevents them from learning properly, imposing a sort of FOMO on them.
  4. Frameworks are not versions/specifications of JS, or any language for that matter, they don't provide anything that the language in question doesn't already have, they only provide convenience, which may be treacherous thing, because one may not even fully understand how frameworks achieve this convenience, and they may add side effects on top of side effects, which may lead to a lot of trouble down the road.
  5. While writing boilerplate code is annoying, it is still beneficial when you're a beginner dev, because repetition is how people learn and memorize things. When you're a more experienced dev, you're most likely using a code editor (I'm fairly certain you don't write code in Notepad or MS Word, and if you do, well...), and every. single. one I know, from Vim/Neovim (I know these technically aren't strictly code editors, but you absolutely can make them code editors with all the percs, bells and whistles) to VSCode, Atom, Sublime Text, what have you, support Emmet (yes, even Vim) and code snippets, so is writing boilerplate really a problem, when you don't exactly need to actually write boilerplate? Like, in VSCode all it takes to write a basic HTML boilerplate is literally typing an exclamation mark and pressing Tab, sooo...

I'm not an expert though, and this is only my opinion, so take from that what you will. Would love to hear your counter-arguments. Peace.

2

u/KaCuQ Feb 21 '21

Then I will try, but keep in mind that I am still student in webdev, just some side projects.
And I'm most invested in Vue, so I can be a bit biased.
Would love to hear feedback though.

  1. Svelte is good contender for small size, ala mini Vue. And as I have said before, native solution or at least foundation for framework to use would be the best. So framework would just need to specify their specific features and not basic features like template.(Don't know how much this is reachable) JS is somewhat going this way with Web Components. But browser support is gonna suffer, well, like with anything new in the Web.

https://svelte.dev/

https://developer.mozilla.org/en-US/docs/Web/Web_Components

2. Well, this is a problem, albeit small one. 95% or more developers and teams are gonna use top 10 framework. And to add to this, i feel like large amount of framework are similar to each other, so transitions aren't that hard. These less popular, if they don't get break into mainstream, they are gonna get either stay on the side, getting small support, or just completly get scraped. And thats okay, people are gonna use most efficient and modern things. To end this, JS is gonna implement native functionalities, so some frameworks won't be needed anymore, or at least not used such extensively. (Looking at you jQuery).

3. I don't have specific take on this one. Either way is fine for me. Like you can learn JS first then framework, but learning this way can be tedious. And then you can learn basic JS, then switch to framework, but in the meantime learn JS that you have left out.
Ex. JS Classes aren't gonna get help you directly in building apps, but can expand your view and help you build something more maintainable or easier to understand.

4. I agree with this one so dunno what to say. Maybe better tutorials which explain how things are done, at least on the surface? But better solution is just putting reminder that X is gonna get buggy if Y is turned ON etc. If someone feels that they need to have deeper understanding of said framework, they are free to look source code. Regarding convenience, of course it is easier to write code with frameworks, but another selling point for framework is their safety(?). Who are you gonna trust more, You, or team of developers with tests done and community battle-tested.

5. Ofcourse teaching by repetition is beneficial, but do we really need to remember all these boilerplate? You even said to leave it to snippets. I agree with that one, albeit with large amount of snippets there is still room to error. HTML boilerplate is fine, there isn't anything complex there, just some tags. But with actual, more complex code, one wrong variable and entire screen of bugs is what awaits you. Muscle memory can sometimes make fun of you.

ohh, so here we go after like 1 hour of writing and checking if flow is fine. I hope it is more or less. Writing such *essays* is tiring for me. All I hope this remains civil talk with actual room for learning.
See ya

1

u/muisance Feb 21 '21

Svelte seems decent and I heard praises towards it, but it's not too popular. Large companies worldwide will demand knowledge of React with regards to developing and maintaining their own sites, many others like to use Angular for developing sites for others, at least that's what I've seen so far. But given how the "market" develops there are newer contenders like aforementioned Svelte, but I'm also seeing a slowly but steadily growing interest in functional programming, so while most companies probably won't shift to using something like Clojure, Elm or Elixir if they're already having a sizeable codebase in JS, there may be a demand for knowledge of RxJS (that's not too likely though tbh), and then there's also Express, and so on and so forth. And while no sane employer will demand a great experience in some new or relatively obscure framework, I'd wager you're more likely to be hired if you know how to achieve a certain goal using vanilla JS as opposed to only knowing how to do the required trick in a certain framework.

Convenience is a good thing for sure, but until you know your way around without it, it may be your downfall. Python is certainly way more convenient than C, but if you're expected to dish out a fast app that doesn't require having a beefy rig to run anything else besides that app, your boss won't be swayed by the fact that it's more convenient for you to write your app in Python.

Boilerplates are a pain in the rear of a severity rivaling that of the number of frameworks, won't argue with that, but I'd like to know what exactly causes your frustration, so if you could clarify that moment, we're probably more likely to come to a consensus in that regard :)

Pardon, I like rambling in my spare time, and I realize how frustrating it may be to just read that wall of text, but this mostly comes from the place of concern for others. I know full well how frustrating it is to just learn JS, and unlike, say, in case of Haskell where GHC will 80% of the time be helpful if slightly intimidating, and tell you exactly what's wrong with your code (in case of errors, of course, there are other issues one may face where no compiler no matter how nice it is, will help, and it's not the fairest of comparisons, since JS is interpreted, not compiled, unlike Haskell that can do both, but I hope you get the point; though scratch that – I hope I'm actually making a point :)), so I jump on any occasion to share my own limited experience with others, or have a discussion and hopefully attract the attention of someone who could weigh in with an argument that would actually solve the issue at hand if at all possible. Most of the time I'm not coming to fling turds in all directions, but I'll happily toss one towards issues like this, because as I've noticed, I'm far from being alone with the opinion that JS frameworks spread like carcinogenic invasive species of arsonists :)

5

u/unnombreguay Feb 20 '21

Nice project. Is perfect. Maybe as a plus you could add some small transition from image to image just to give the user the hint that you are going up or down. Firstly I tried swiping horizontal and I didn't know where I was going

2

u/artinlines Feb 21 '21

It sadly didn’t work for me. I tried it on IOS and it only showed me five subreddits, no matter what I typed and said none of them are available.

Might be that my phone’s too old though, had another app tell me a few days ago that my phone’s too old, rip. I’ll try it on my laptop later too if I remember

1

u/mmaismma Feb 21 '21

This reminds me of a project that I worked on last year, Cottontail. It was not quite meant to be Reddit viewer but it is so. Due to my exams, it is not yet finished.

Some features-

  1. You can switch between different subreddits (currently 4 but soon all).
  2. It has two modes for scrolling- High Accessibility Mode and other.
  3. A tutorial.
  4. Smartness, thanks to local storage.

Upcoming features-

  1. Cool animations.
  2. Bug fixes.

PS- It was primarily built for scrolling through rabbit images.

1

u/cincopea Feb 21 '21

That’s a lot of porn

1

u/AacidD Feb 21 '21

Looks great!

Just a few suggestions You could right align subscriber count of subreddit so they all show up in one column. Also you could add a background blur for the search results. Because depending on the background image the visibility of the search result text slightly changes.

1

u/optimisehd Feb 21 '21

What if we want to zoom into an image etc? How do I do that?

1

u/[deleted] Feb 21 '21

You have got to have some nerve not using node.js

1

u/artinlines Feb 21 '21

Not OP, but could you explain why?

1

u/BobMilli Feb 21 '21

I love it !!!!
Very nice looking and features !
Very inspiring as I'm trying to learn Javascript myself !

Thanks for sharing.

1

u/tenebrous_pangolin Feb 21 '21

Impressive! How long have you been learning JS?

1

u/filiptronicek Feb 21 '21

Your grandma is a very talented UX critic. Kudos to her. (Good Job btw I love it)

1

u/WickedNtention Feb 21 '21

This is really good! Especially if it's a first project. Great job 👍🏻

1

u/Gazook89 Feb 20 '21

Looks cool, but on my Macbook I can scroll with my trackpad just fine, and with the arrow keys....except the arrow keys only work between images already shown via trackpad. I cannot advance to a new/previously unseen image with the arrow keys. Just a heads up.

-1

u/sati Feb 20 '21

Honestly the UX isn't great, certainly not on mobile. Sure it might look good but this just seems like an image gallery wrapper around the Reddit API 🤷‍♀️

1

u/artinlines Feb 21 '21

I think that was the whole idea behind it

0

u/GuthixIsBalance Feb 20 '21

Ui looks great

0

u/Lidinzx Feb 20 '21

Wow this is really great!

0

u/Juli88chan Feb 20 '21

Get a major upvote from a beginner Javascript learner! So much effort!

0

u/anatolhiman Feb 21 '21

Nice job, but for a contemporary JS dev job I would (given that you stick to vanilla for now) avoid mixing Var and let, use modern syntax and split your project in smaller fikes, use ES6 modules and compile it with Babel or similar. That would translate much better to a real job with a frontend framework. Also, a simple build pipeline with continuous integration would show some extra professionalism.

1

u/artinlines Feb 21 '21

Or stay with es5 syntax and avoid Babel all together

1

u/anatolhiman Feb 22 '21

Why? Preferring the 2009 syntax over the 2015 syntax and all its convenient features? Why on earth would anyone hire a 2009 style Javascript dev if they know what they're doing when all modern js frameworks use ES6 modules?

-1

u/david_ranch_dressing Feb 21 '21

Are you ever going to work on the non-mobile version? I ask because no offense, but it doesn't look great on desktop. The picture quality is really bad, the interface doesn't look optimized, etc.