Comments (9)
getting rid of a data context, instead of replacing it with scope
Yes please!!
arguments can be marked as constructor-level argument, or render-level argument
Not sure what this means? Also, there are so many ways to specify types of arguments... React PropTypes, Meteor Match, etc. which one do we use?
each argument is exposed as a method on the component
Perhaps this.args.x
? Or we just expect people to avoid collisions? Maybe we can just warn on collisions.
Events handlers are internal to the component.
So should people use the React-style callback passing to set event handlers on children?
from meteor-blaze-components.
arguments can be marked as constructor-level argument, or render-level argument
Not sure what this means?
In Blaze Components you have two types of data which can come to a component. One is what is passed to the component's constructor, another is which is currently a data context. The difference is that if the first arguments change, we recreate/reinitialize the component, if a second argument changes, only the state of the component changes, and things re-render reactivelly.
Currently, you could pass or another, but not both. And now I am proposing that this is simply metadata of the argument, how it should be provided to the component (and which time).
Also, there are so many ways to specify types of arguments... React PropTypes, Meteor Match, etc. which one do we use?
None, as specified above, so that we do not force evaluation of a reactive function passed.
Or we just expect people to avoid collisions? Maybe we can just warn on collisions.
To me arguments is something you would add to your component inside a constructor. You should make sure you do not clobber any prototype method you have there anyway. And yes, we could check if a component has a prototype method defined the same as you defined that potentially arguments could be.
So should people use the React-style callback passing to set event handlers on children?
So, arguments can be functions. And so yea, you could do onClick={{argumentPassedFromParent}}
in a child template, probably. Or your child template could do onClick={{parent.childOnClick}}
if parent
was passed as an argument to child component, and has childOnClick
as a public method. So in the latter case there is a constraint on what types of parent
values are allowed, one with childOnClick
public methods.
from meteor-blaze-components.
It would be great to have something like reacts componentDidUpdate, sometimes you have to use jQuery libs and stuff like this saves time (in the situations when you receive new data, but the template already rendered, but you need jQuery to do something with new data);
It's quite hacky and not the intended way of properly doing things, but well, every time I hit this kind of situation I need to reinvent the wheel :) .
from meteor-blaze-components.
@mitar everything looks awesome here, and I'm very excited to see public methods as one of the priorities. I'm not going to comment everything because I agree with all the changes, but I can suggest implementations (as a new but already heavy user view).
One thing that we already created is a sharedState
variable to be our central reactive source between components. I identify all components at startup and create a reactive data source for each one that can be used and accessed by all components. Is that something to consider? If yes, I have some ideas.
from meteor-blaze-components.
I identify all components at startup and create a reactive data source for each one that can be used and accessed by all components. Is that something to consider? If yes, I have some ideas.
Isn't this the same as Session
?
from meteor-blaze-components.
@stubailo Session
can be used here, but I'm thinking in something more scoped to the component it self. Using Session
would require me and my team to be careful about variable names and everything. What we are doing is something like this:
commonState.componentName.VariableName()
This way we know that this is a variable
that has componentName
as parent. It's a simple (mostly because of ReactiveVar
We are thinking about changing the method to something like this this.shareState('foo', bar);
. And in another component I can use this.getState('component', 'foo');
.
At least for us this makes a lot of sense. I can already think about some implications of this implementations. For example, what if I have multiple components rendered on the page? That means that all of them will share the same state? Maybe yes, maybe no.
Does it makes sense for you now, @stubailo ? If no, I would love to hear maybe a simpler implementation that we can use.
from meteor-blaze-components.
I guess that seems just as global, since it's just like saying Session.get('componentName/variableName')
but if it works for you that's great!
from meteor-blaze-components.
It would be great to have something like reacts componentDidUpdate, sometimes you have to use jQuery libs and stuff like this saves time (in the situations when you receive new data, but the template already rendered, but you need jQuery to do something with new data);
When should this run? On every change? Of any attribute of any dom element?
One thing that we already created is a sharedState variable to be our central reactive source between components.
Why don't you just use Minimongo/local collections on the client? It has nice things like easy limiting of reactivity, complex queries against data, and so on? You could have one document per component. You could in onCreated
create such document, if you for example to have independent state per each component.
But anyway, this is for me orthogonal question to view layer. I do not think this should be part of the view layer, but it should just allow its use. Personally, I do not see the benefit of what you are proposing. But everyone has its own preferences here.
from meteor-blaze-components.
Yeah, looks like I did it the wrong thing all the way, though I used the client-side collections.
Thank you :)
from meteor-blaze-components.
Related Issues (20)
- Example of mixin for two-way binding HOT 3
- TemplateTwoWayBinding HOT 3
- Template2
- How do you guys do Modals? HOT 8
- [Question] Best way to create a documentation about components HOT 23
- [Question] Migrating to Blaze once the npm version is released. HOT 1
- Write template HTML within component JS? HOT 2
- How to unit-test a component? Guidance needed HOT 5
- Values is not defined HOT 2
- General Question HOT 1
- Interfacing with react.js HOT 6
- In-line component creation for lack of method params HOT 3
- What projects besides weekan are built with this library HOT 3
- Performance HOT 1
- Template Strings ? HOT 1
- Support coffeescript 2 (in Meteor 1.6.1) HOT 8
- Migrating to react: Rendering of BlazeComponents via React is NOT possible HOT 2
- error updating to Blaze Components 0.23 & Meteor 1.8.2-rc.3 HOT 3
- Meteor 1.8.2: ReferenceError: meteorBabelHelpers is not defined HOT 16
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 meteor-blaze-components.