Ah, sorry. I didn’t add the part where Input
is defined. That would be a component the user would make. Also the point is that it’s easy to know what it is by looking at it.
Adding propTypes
acts as documentation and makes it easy to know what you can pass into your custom component (something I hope Blaze 2 utilizes).
That would be something like:
Input = React.createClass({
propTypes: { // optional but recommended for documentation
name: React.PropTypes.string.isRequired,
label: React.PropTypes.string.isRequired,
type: React.PropTypes.string.isRequired,
},
render() {
let defType = this.props.type || 'text';
return (
<div class="form-group">
<label for={this.props.name}>{this.props.label}</label>
<input type={defType} class="form-control" name={this.props.name}>
<span class="err-msg"></span>
</div>
);
}
});
> With this discussion about React and Angular, doesn't anyone think that W3C standards are important anymore? I'm not convinced with React, it's just not seem to be contributing to an "open web".
I mean technically React outputs more standards compliant code that I write normally. Sure JSX is a bit different as they use DOM attributes like className
instead of class but that’s not the output.
When web components ‘finally’ gets here they’ll make a React 2.0 that compiles a component to a standard ‘web component’.
> You seem to have a lot of experience with React so I'd like to ask a truly honest question: Do you think something else will start to replace React in 12 months?
There will def. be other options but React brings more than a template to the table and that’s what will keep them in the top of choices. They bring:
- Huge community
- Large array of components (react.parts), more than Atmosphere
- Ability to render JSX to non-browser env (server, iOS, TVs)
-
Paradigm shift in how to ‘think’ about the UI (declarative & functional vs imperative)
- Stability (FB/Instagram uses this itself and has to keep it stable for quite a while)
[quote="chompomonim, post:196, topic:13561"]
Current projects, hundreds of popular packages (like autoform or easysearch) and their migration into 'Blaze2'? I believe MDG will try to help them for easier migration, but unfortunately it will cost. Especially if somebody is depending on packages such as autoform, @aldeed already told, that most probably it will not work for 'Blaze2'.
[/quote]
I’m working on a example project that shows how easy it is to do this with Tabular Tables and Autoform. All you’ll need to do is write Blaze-1 for the things in Autoform. The ‘migration’ is a 5 min. tops.
Also most components are note quite this coupled to Blaze so the majority won’t be extra work.
Outside of the scope of this but using these highly coupled packages like those comes at a huge maintenance cost. They’re quick to install and very slow to change/modify. FlowRouter is not coupled and switching view layers is a one liner. (though autoforms would be hard to do with this admittedly)