reflux / discuss Goto Github PK
View Code? Open in Web Editor NEWGeneral discussion about Reflux!
General discussion about Reflux!
Does the CQ resample perform a full scan of the originating data or is it an incremental build based on new entries since last sample?
Docs are not clear on it:
https://docs.influxdata.com/influxdb/v0.10/query_language/continuous_queries/
In my library I refused from action listening. You can also do it in Reflux.
I implemented your Counter example with using my library and with using Reflux without actions:
UIStates Counter
Reflux Counter without actions
I look at actions/listeners as a publish/subscribe pattern and use actions wherever and in series if called for. Some flux implementations seem to have a problem calling an action from within another action. I have not had any issues doing Action -> Store -> Api.get -> Api.got -> Action -> Store -> Action -> Api.get -> Api.got -> Store -> Store.trigger. Do you see any problem using this pattern in reflux?
Normally in reflux we have several Actions
files, containing list of strings, and in the stores we add methods like: onSomeAction
. we have to manually connect everything, and when we change the name of the Action we do it twice or more.
Usually, I don't share Actions between stores, and this duplication is really annoying.
So I came up with this:
function createStoreAndActions(storeObj) {
function startWithOn(str) {
return str[0] === 'o' && str[1] === 'n' && str[2].toUpperCase() === str[2]
}
var ActionStrs = Object.keys(storeObj).filter(startWithOn);
let Actions = reflux.createActions(ActionStrs);
if (storeObj.listenables) {
if (Array.isArray(storeObj.listenables)) {
storeObj.listenables.push(Actions);
} else {
storeObj.listenables = [storeObj.listenables, Actions];
}
} else {
storeObj.listenables = Actions;
}
return {
Store: reflux.createStore(storeObj),
Actions
}
}
the convention I've used is taking all methods starting with 'on' and having capital letter after that. Of course it's easy to implement any other convention (e.g passing to create
an array of strings etc)
then I can just specify those methods, and an auto actions will be created.
let {Store, Actions} = createStoreAndActions({
mixins:[...],
onTestAction(){
console.log('it is working with no explicit Action!')
}
});
export {Actions};
export default Store;
and in Component:
import TestStore, {Actions as testActions} from '../Stores/TestStore';
var Component = React.createClass({
render: function() {
return (
<div onClick={testActions.onTestAction}>click here to log from store</div>
);
}
});
Answered my own question!
Hi ,
Is Reflux supports in SAFARI, I had seen in github page its only for firefox, chrome, IE, Opera.
Hello.
I was writing a simple imgur client: https://github.com/eko24/react-imgur
So I decided to add image upload feature using react-dropzone.
But I'm not sure if I'm using stores and actions in a right way.
Could any one take a look ?
I really appreciate any help you can provide.
The unidirectional dataflow makes perfect sense if user interaction always (or never, as in most tutorial examples) gives rise to remote changes. A typical case:
Another way to put this might be that every modification to the local store is mirrored by a change in the remote store. However, for various reasons, this is not always desirable. In a lot of situations, it makes sense to only call the server once editing is complete, e.g. upon pressing a "Save" or "Post" button.
I can see this happening in a multitude of situations. For example, without knowing the implementation details, it seems likely that when creating events on Facebook, all data (date, title, description, guest list etc.) is stored locally until the user hits the "Create Event" button.
It seems logical to introduce an action like CommentActions.postComment(), but that creates a difficulty: there is no obvious way for the action to access all the data that has been supplied and edited to that point, unlike the first case where each action is fed the data subject to change (e.g. the title).
The best way I've come up with so far is to make the component responsible for feeding the right data to the action. The local values are held in the store, and are thus accessible to the component through mixing in of state. When it's time for the final save, it's triggered by e.g. CommentActions.postComment(this.state.title, this.state.body, this.state.email, ...).
I suppose there are many solutions involving breaking the Flux flow (e.g. having the store calling actions) but I'm only interested in solutions that don't break the very basic principles behind the library :)
I have created a generic autocomplete component which I am using in a form for add and edit operations.
I have a autocompletestore where I fetch the data and set the state.
Component defines the onautocompletestorechanged function and updates ita state. Auto complete is rendered accordingly. Now the problem is every time the store changes all instances of this component render the autocomplete which is not intended. I only want the autocomplete to render for the component in which I am typing. Please help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.