Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I don't understand why having an .html app bundle is a bad idea, to be quite honest.

The reason is because I need to be able to upload this "app" as an attachment to another service. It's an internal tool, and we don't have an intranet to deploy it on yet. It's complicated.

Adbot
ADBOT LOVES YOU

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



It's also basically the same as https://en.wikipedia.org/wiki/MHTML which is a neat format IMO

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

ModeSix posted:

Jesus just looking at his post history in this thread, it's almost like he's trying to troll us.

What about my posting history is bad? I said Angular is bad and React is good, which seems to be the generally agreed upon Correct Opinion these days.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
Get real people. Folks been inlining chunks of JavaScript for a real long time now, for performance boosts. The only thing that is questionably dense to inline is images, but all of this can be overcome of you have a decent build process.

Y'all doubters are a bit close minded, the whole point of our extensive tooling is the way we deploy doesn't have to represent out code structure. This approach isn't suitable for everything obviously, but it's not a bad way to ensure the cache is busted and everything is included.

consensual poster
Sep 1, 2009

Suspicious Dish posted:

I really don't understand the new web build process stuff. How do I build a .html file that references my fancy new modules with something like webpack? I'm in the guts of file loaders and html webpack plugins and I really don't understand any of it.

What you probably want is the html-webpack-plugin. I'm using it on my current project to inject the webpack bundles into my index.html file as part of the build process. It even adds hashes to prevent clients from using cached resources.


You just have to require the plugin and register it in the plugins section of your webpack.config.js:

code:
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpackConfig = {
  plugins: [new HtmlWebpackPlugin({
    template: 'src/index.html',
    inject: 'body',
    hash: true
  })]
};

Stoph
Mar 19, 2006

Give a hug - save a life.
When I used to use GWT at work it would compile the entire project into an HTML file. It was actually super convenient.

n4
Jul 26, 2001

Poor Chu-Chu : (
I started a new front end dev job this past week, and they took webpack and built their own custom version that compiles Jade/Pug, PostCSS, and JavaScript all at once into separate html/css/js files. I'm a React guy so I was skeptical about it, but I've been using it on a project and it's actually awesome to work with. I just started integrating some Vue.js into my project as well.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Anyone doing React+Redux in TypeScript?

  1. How well does it work?
  2. Do you feel like you're contorting the tools?
  3. When getting help from the internets for React or Redux do you ever wish you were just writing vanilla ES6?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Thermopyle posted:

Anyone doing React+Redux in TypeScript?

  1. How well does it work?
  2. Do you feel like you're contorting the tools?
  3. When getting help from the internets for React or Redux do you ever wish you were just writing vanilla ES6?

I have not done it, but I've seen it done. It gets a little verbose as you have to explicitly state your types at all times, as TypeScript has trouble inferring them. It may be possible to make more concise, but I've not had time to work on it (because React is the devil and I hates it).

Ochowie
Nov 9, 2007

Thermopyle posted:

Anyone doing React+Redux in TypeScript?

  1. How well does it work?
  2. Do you feel like you're contorting the tools?
  3. When getting help from the internets for React or Redux do you ever wish you were just writing vanilla ES6?

In my limited work with it (and my general terribleness), the most annoying thing I've seen is that if you specify an interface for a component's props and you're using react-redux connect to map them in from the store, then you need to mark those interface members as optional otherwise it will fail to compile. There is also some weirdness in terms of specifying the return types of mapStateToProps and mapDispatchToProps. Basically if you don't setup the types accordingly it will infer it to be an intersection type of the return types of mapStateToProps and mapDispatchToProps rather than a combination of them.

Edit: Also, if you have a reducer that operates on actions with more than on payload type then I guess you would have to define a union/intersection type for that payload and then test (and cast) the action payload to that type.

Also, the object spread operator isn't part of the language yet which I've found to be infinitely better than Object.assign but that might be preference.

Ochowie fucked around with this message at 01:54 on Jun 7, 2016

Gildiss
Aug 24, 2010

Grimey Drawer

Skandranon posted:

It may be possible to make more concise, but I've not had time to work on it (because React is the devil and I hates it).

I have just started dipping my toes into React in my down time and I am kind of liking it after having been working with Angular for a year now.
But my roots are in functional and not OO, so that may be why.
What are the specific reasons you have for React being demonic?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Gildiss posted:

I have just started dipping my toes into React in my down time and I am kind of liking it after having been working with Angular for a year now.
But my roots are in functional and not OO, so that may be why.
What are the specific reasons you have for React being demonic?

Perhaps that was a bit hyperbolic... I mainly do not buy into the promise that functional will fix all our woes and if only everything was pure the world would be at peace, etc. I have enough time for one major framework, and for better or worse that is Angular 1 & 2 for now.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
I wouldn't call React pure. You don't need to take it as far as redux everything perfectly if you don't want to. I don't think there's any need to drink the kool-aid to use or benefit from React.

Elm is React taken to the nth degree, in a proper functional language, React is very much the pragmatic middle ground here.

Kekekela
Oct 28, 2004
I agree with React being very pragmatic. I just introduced it on a project at work (MSFT environment) because I felt the client side code was going to be an unmaintainable clusterfuck if we tried to go vanilla or with a more doc-centric approach. The only thing really holding me back at that point was the terror of introducing new things while under the command of my winforms loving boss, but VS embracing React really helped with that.


fake edit: I feel kind of letdown with what this post turned into, as I've written and deleted so many words extolling its virtues and describing my path to react enlightenment, but couldn't come up with anything that wasn't rambly even by my standards.

Huzanko
Aug 4, 2015

by FactsAreUseless
Is Bower still OK to use or does it make me an oldie and a baddie?

Huzanko
Aug 4, 2015

by FactsAreUseless

Skandranon posted:

Perhaps that was a bit hyperbolic... I mainly do not buy into the promise that functional will fix all our woes and if only everything was pure the world would be at peace, etc. I have enough time for one major framework, and for better or worse that is Angular 1 & 2 for now.

I am kind of in the same boat. It's too bad Angular 2 code looks loving horrible to write, and very verbose for simple things.

My problem with React is FLUX and anywhere you go to learn React really hammers on using FLUX to do React "correctly." That's fine, and FLUX may be great, but as someone who really gets and likes MVC, hitching my wagon to something new supported by only one new technology so far is a tough sell.

aBagorn
Aug 26, 2004

Noam Chomsky posted:

I am kind of in the same boat. It's too bad Angular 2 code looks loving horrible to write, and very verbose for simple things.

My problem with React is FLUX and anywhere you go to learn React really hammers on using FLUX to do React "correctly." That's fine, and FLUX may be great, but as someone who really gets and likes MVC, hitching my wagon to something new supported by only one new technology so far is a tough sell.

Flux is so 2014. Get with the Redux action folks.

React/Redux/Relay/GraphQL

Facebook up and down the stack.

Serious note I just started playing around with GraphQL after hearing 5 separate discussions on it at React Europe last week and yeah it's pretty boss

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Noam Chomsky posted:

I am kind of in the same boat. It's too bad Angular 2 code looks loving horrible to write, and very verbose for simple things.

My problem with React is FLUX and anywhere you go to learn React really hammers on using FLUX to do React "correctly." That's fine, and FLUX may be great, but as someone who really gets and likes MVC, hitching my wagon to something new supported by only one new technology so far is a tough sell.

As has been talked about before here a bit...flux can basically be thought of as MVC.

But anyway, all the cool kids are using Redux...which is similar in a lot of ways to flux.

I've got to agree with Maluco Marinero when he says React isn't the One True Functional Way...that's elm. React is pragmatic and pretty undogmatic about it.

Huzanko
Aug 4, 2015

by FactsAreUseless

aBagorn posted:

Flux is so 2014. Get with the Redux action folks.

React/Redux/Relay/GraphQL

Facebook up and down the stack.

Serious note I just started playing around with GraphQL after hearing 5 separate discussions on it at React Europe last week and yeah it's pretty boss

I guess I just assumed a Redux was an implementation of FLUX.

Glad I never wasted time learning flux. I probably shouldn't waste time on Redux since it won't be around next year, I assume.

Depressing Box
Jun 27, 2010

Half-price sideshow.

Noam Chomsky posted:

I guess I just assumed a Redux was an implementation of FLUX.

Glad I never wasted time learning flux. I probably shouldn't waste time on Redux since it won't be around next year, I assume.

Don't waste time learning anything, all is temporary, embrace oblivion.

Huzanko
Aug 4, 2015

by FactsAreUseless

Depressing Box posted:

Don't waste time learning anything, all is temporary, embrace oblivion.

I've already embraced oblivion and I love learning new things, however with a finite amount of time available one must choose what to learn carefully.

Depressing Box
Jun 27, 2010

Half-price sideshow.

Noam Chomsky posted:

I've already embraced oblivion and I love learning new things, however with a finite amount of time available one must choose what to learn carefully.

That's fair, and I get where you're coming from.

In the specific case of Redux, it's pretty straightforward, with a low time investment to pick up the basics. And even if Redux proper doesn't stick around long-term—it's a JavaScript library, it probably won't—many of its core concepts (like a single immutable state tree) are showing up elsewhere, so general knowledge should carry over.

Egghead.io has a free intro to Redux course by the library's creator, and the first few lessons (maybe 10–15 minutes total) should be enough to get you started.

aBagorn
Aug 26, 2004

Depressing Box posted:

That's fair, and I get where you're coming from.

In the specific case of Redux, it's pretty straightforward, with a low time investment to pick up the basics. And even if Redux proper doesn't stick around long-term—it's a JavaScript library, it probably won't—many of its core concepts (like a single immutable state tree) are showing up elsewhere, so general knowledge should carry over.

Egghead.io has a free intro to Redux course by the library's creator, and the first few lessons (maybe 10–15 minutes total) should be enough to get you started.

I was just going to post this. Abramov's egghead course is pretty spectacular for getting the basics down.

Instead I'll post the follow up -> just published last week

https://egghead.io/courses/building-react-applications-with-idiomatic-redux

also this is worth a watch:

https://www.youtube.com/watch?v=ViXL0YQnioU

aBagorn fucked around with this message at 18:50 on Jun 7, 2016

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Noam Chomsky posted:

I've already embraced oblivion and I love learning new things, however with a finite amount of time available one must choose what to learn carefully.

Some good things about React and Redux:

1. They are small in concept which means its easy to grasp them in a short amount of time.
2. They have good docs which means its easy to grasp them in a short amount of time.
3. They embody ideas and practices that are more and more widespread so even if they disappear tomorrow you're set up for the future.
4. Redux is very usable outside of React.

Huzanko
Aug 4, 2015

by FactsAreUseless

Thermopyle posted:

Some good things about React and Redux:

1. They are small in concept which means its easy to grasp them in a short amount of time.
2. They have good docs which means its easy to grasp them in a short amount of time.
3. They embody ideas and practices that are more and more widespread so even if they disappear tomorrow you're set up for the future.
4. Redux is very usable outside of React.

Thanks for these.

I think a lot of my problem is being stuck in Angular land after doing Angular 1.x for he last 2 years or enterprise clients. After mastering something so complex and developing some pretty good practices and structures for using the framework to great effect, it's tough to be told that now it's time to switch to something mostly totally new, and that goes for Angular 2 and React both.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'
What problems do you guys have with Angular 2 re: verbosity? It seems fine to me, but that might be my recent C# background inuring me.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Noam Chomsky posted:

Thanks for these.

I think a lot of my problem is being stuck in Angular land after doing Angular 1.x for he last 2 years or enterprise clients. After mastering something so complex and developing some pretty good practices and structures for using the framework to great effect, it's tough to be told that now it's time to switch to something mostly totally new, and that goes for Angular 2 and React both.

I get the feeling. It's difficult and frustrating to move from something you know to something you don't know.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

dupersaurus posted:

What problems do you guys have with Angular 2 re: verbosity? It seems fine to me, but that might be my recent C# background inuring me.

Yes, I've been wondering about that too. Aside from declaring your dependencies being a little more verbose than Angular 1, your TypeScript should look almost identical. If you are also making the move from JavaScript to TypeScript when going from Angular 1 to Angular 2, then yes, TypeScript is a little more verbose, but you should want to start being explicit about your types when using TypeScript.

Huzanko
Aug 4, 2015

by FactsAreUseless

Skandranon posted:

Yes, I've been wondering about that too. Aside from declaring your dependencies being a little more verbose than Angular 1, your TypeScript should look almost identical. If you are also making the move from JavaScript to TypeScript when going from Angular 1 to Angular 2, then yes, TypeScript is a little more verbose, but you should want to start being explicit about your types when using TypeScript.

I may just have seen some poorly written Angular 2 code.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Noam Chomsky posted:

Thanks for these.

I think a lot of my problem is being stuck in Angular land after doing Angular 1.x for he last 2 years or enterprise clients. After mastering something so complex and developing some pretty good practices and structures for using the framework to great effect, it's tough to be told that now it's time to switch to something mostly totally new, and that goes for Angular 2 and React both.

My $0.02:

React is a pretty simple view framework. It also taught me about thinking the views of my web apps as simple state rendering machines. I can use React with whatever I decide to hand it state with, and I can use what I learned even if I dump React.

Redux is a pretty simple state management framework. It also taught me about immutability, functional programming concepts, and other neat stuff. I can use Redux no matter what I decide to render my views with, and I can use what I learned even if I dump Redux.

With Angular, I felt like I learned Angular, and when I ditched Angular, I "lost" everything.

Huzanko
Aug 4, 2015

by FactsAreUseless

Lumpy posted:

My $0.02:

React is a pretty simple view framework. It also taught me about thinking the views of my web apps as simple state rendering machines. I can use React with whatever I decide to hand it state with, and I can use what I learned even if I dump React.

Redux is a pretty simple state management framework. It also taught me about immutability, functional programming concepts, and other neat stuff. I can use Redux no matter what I decide to render my views with, and I can use what I learned even if I dump Redux.

With Angular, I felt like I learned Angular, and when I ditched Angular, I "lost" everything.

Good point and that's probably how I am feeling right now, even though I haven't abandoned Angular 1.x yet.

My problem is mostly that I have things that I want to build and I can build them with what I know - Angular 1.x, Rails, etc. - but every where I look I am being told I need to switch to React, WebPack, Node in order to stay relevant. It's frustrating, as I am sure many have lamented here.

n4
Jul 26, 2001

Poor Chu-Chu : (
React, Redux, and Webpack are all good, easy to learn and worth learning.

Lumpy said it best, but to add to that I recently had to learn Vue.js at my job, and it was super easy because of my React knowledge. After one pass through the docs I was ready to start building Vue.js stuff in my project. Point being there are many libraries that use similar concepts and you get more out of learning these things than just React-specific knowledge.

Odette
Mar 19, 2011

n4 posted:

React, Redux, and Webpack are all good, easy to learn and worth learning.

Lumpy said it best, but to add to that I recently had to learn Vue.js at my job, and it was super easy because of my React knowledge. After one pass through the docs I was ready to start building Vue.js stuff in my project. Point being there are many libraries that use similar concepts and you get more out of learning these things than just React-specific knowledge.

I'm starting to get that I should be focusing on general purpose software devs/engineering knowledge rather than knowledge of a specific thing (React, etc).

Are there any decent books/resources out there that would be good to look at?

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
Beware: what follows is a bunch of opinions based on what I felt helped me learn things, won't apply to everyone.

The original 'The Pragmatic Programmer' isn't a bad one for a bunch of concepts that are widely applicable, but once you get into proper code every thing is gonna pick a language to demonstrate with some level of opinionation.

How to Design Programs...

http://www.ccs.neu.edu/home/matthias/HtDP2e/

...is a really nice look at boiling down a program to non language specifics, the data, the constants of the world, the behaviours, etc.


I also feel like you'll benefit from learning the basics and writing a few things of languages that adopt different paradigms. Writing Python and then writing Ruby does far less to diversify your knowledge than Python, then Haskell (pure functional), then Scala + Java... Which makes me think I'm due to tinker with something else as I haven't invested much into my knowledge lately, maybe play with c++ s'more.

While I don't use Haskell much these days, the concepts using it taught me are present in everything I write these days, so I think it's very important to expand beyond your own ecosystem if you want to learn. There's very little new under the sun, the resurgence of functional code in JavaScript's ecosystem 100% comes from ideas taken elsewhere, there is definitely a cap of learning within your comfortable space, where all you'll read is yet another lovely blog article covering things you know about already.

Huzanko
Aug 4, 2015

by FactsAreUseless

n4 posted:

React, Redux, and Webpack are all good, easy to learn and worth learning.

Lumpy said it best, but to add to that I recently had to learn Vue.js at my job, and it was super easy because of my React knowledge. After one pass through the docs I was ready to start building Vue.js stuff in my project. Point being there are many libraries that use similar concepts and you get more out of learning these things than just React-specific knowledge.

I think I'm just weird. Most of the folks who love React also seem to hate Angular or found it only barely tolerable. I was super comfy with Angular from day one so I guess it's possible I am over-thinking React.

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Noam Chomsky posted:

Is Bower still OK to use or does it make me an oldie and a baddie?

it's ok, but it's slowly dying. here's a bower dev DeSandro



bower seem to not letting their ego get in the way very much. good on them :thumbsup:

N.Z.'s Champion fucked around with this message at 03:43 on Jun 10, 2016

Stoph
Mar 19, 2006

Give a hug - save a life.

N.Z.'s Champion posted:

it's ok, but it's slowly dying. here's a bower dev DeSandro



bower seem to not letting their ego get in the way very much. good on them :thumbsup:

https://github.com/bower/bower/issues/2298

Huzanko
Aug 4, 2015

by FactsAreUseless

It's weird that something that is dying keeps showing up in new courses, tutorials, and yeoman generators.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Noam Chomsky posted:

It's weird that something that is dying keeps showing up in new courses, tutorials, and yeoman generators.

Welcome to front end development!

Adbot
ADBOT LOVES YOU

Pollyanna
Mar 5, 2005

Milk's on them.


Speaking of yeoman generators, what's the most accepted way to start up a new React SPA project? This would be something that only interacts with an API, so it won't require a back-end like Express or anything. Something that just compiles to static HTML/ES6/CSS and that I can just publish onto a lovely intranet Windows server or something (it's complicated).

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply