Comments (8)
Web components are interesting. But I'm a much bigger fan of the composability model than the inheritance model. I've never built anything with them, but from what I know I think I'm going to likely stay away from them and stick with existing solutions.
That said, I'm totally open to trying new things and seeing how they can make me more productive, so I'm keeping my eye on them.
from ama.
Oh, and as far as web components being the future... I'm on the fence on that one... But I'd say it's probable.
from ama.
I don't think Web Components are the way to go. Wilson Page wrote a good summary in The state of Web Components.
Web Components are a good play for Google to make it easier for web developers to add more complex functionality (and hook into Google services) to web sites. Polymer moved very quickly from 0.5 to 1.0 release (with breaking changes) and added shady DOM (shadow DOM to complex/hard to implement?).
I don't think declarative markup is the way to build applications. Agree composability over inheritance (remember controller hierarchy and $scope in Angular 1).
Why 3 languages - HTML, CSS and JavaScript? Just use JavaScript. Yes you still have to generate HTML and CSS for the browser but you can work in a more powerful programming language that you know already. Things like HTML imports are not necessary with ES6. For example you can already import HTML and CSS with jspm using ES6 module syntax.
from ama.
Yeah, and for me, I use webpack so I don't need to worry about "imports". I simply import './the.css'
and just use the css-loader
with the style-loader
and it works (pre-processors are easy too). If I were doing React I wouldn't use css at all, but inline styles instead. Still haven't gotten around to doing this in my project at work.
As for the HTML, I'm in huge agreement with @gdi2290 on this. Inline your templates, makes template code smells easier to spot, also gives you a lot more power because you're in JavaScript land. Though I'm still not a huge fan of the fact that it's a string that's parsed. Love that React's components are just functions. Mind-blowingly simple imo...
from ama.
jspm css is similar to webpack import './the.css!' where '!' tells jspm to use the systemjs css plugin.
I'm also inlining templates as per @gdi2290 - there are some gnarly ones that are best kept separate but really points to fact that more abstraction to components (directives) is required. This looks like a way forward
https://github.com/andreypopp/es6-template-strings-jsx/
from ama.
That's interesting... Is the css thing part of the spec? It was my impression that System.js was trying to follow standards.
there are some gnarly ones that are best kept separate
That's the reason that you inline your templates (as you stated). It makes you feel the pain of these gnarly ones so you create a directive for sections of it. So I'd recommend still inlining those. I'm slowly removing all .html
files from my project.
from ama.
it's hard to switch from templateUrl mindset. The best way to describe it is in another perspective. Think of Components as Services, now with Services we know that if there are way too many methods going on we probably should refactor into many different Services. Doing so allows us to keep each Service small with it's use domain specific concern. Now what about directives? Well think of them as helper functions that help you create a certain behavior. Now there are still reasons why you would use templateUrl but it's better people to run into the problem and realize they need to refactor into templateUrl rather than the other way around. One example of this type of suggestion is always using $apply
you would always use it when you change your model. Until you understand exactly what's going on with the digest cycle you can start optimising your state management to isolate the trigger of the digest cycle (this step is never practiced in Angular apps today)
from ama.
I have never needed to use templateUrl
ever since I started using webpack. The only use case I can think of is to allow people to override templates via the $templateCache
. But in my apps, I have no need of that.
from ama.
Related Issues (20)
- Trying to find a video I saw 2-3 years ago HOT 1
- What were the features you were missing in buttondown? HOT 1
- Article Idea
- JSDOM doesn't dynamically provide the clientHeight HOT 1
- How to keep updated react context value inside a callback in a custom hook HOT 2
- UseEffect hook and testing-library HOT 4
- Testing visuals with React Testing Library HOT 2
- Who is the version of you for React Native
- What is the best approach to analyze the code base healthy of existing projects?
- Epic React Course HOT 3
- question according to useImperativeHandle in react?
- Compound Component in React
- What approach do you prefer to cache data to not call the server every time when useEffect re-render? HOT 1
- Async beforeEach for fetching data HOT 1
- Choose a Backend As A Service for prototyping HOT 1
- Using Error boundry in react app HOT 2
- Question regarding your useMemo & useCallback blog HOT 4
- Using testing-library wrapper with redux to test components
- React/Redux testing with react-testing-library
- What resources do you use to keep up to date on the direction of the industry? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ama.