davidbruant / baredux Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
increaseCount2(state){
return {
count = state.count + 1
}
}
it should be count: state.count + 1
, right ?
(based on feedback from @davidbgk )
const store = new Store({
state: {
count: 0
},
mutations: {
increase(state, supplement){
state.count += supplement
}
}
})
const {state, mutations, subscribe} = store;
console.log(state.count) // 0
mutations.increase(2)
subscribe(state => {
console.log(state.count) // 2
})
count
is 2
right after the call to increase
, so the subscribe isn't really useful
container components are components that are arbitrarily deep in the component tree but have a direct access to the store without the store being passed as props (they use a context so any component can access the store and container components transform the store into props with mapStateToProps
)
Right now, baredux has no explicit support for container components, but i consider them a meaningful use case
To begin with, let's write an example of what it would take to write a container component with a React Context manually
If that's annoying to do by hand, let's provide a helper in the library
Unless Google Search results quickly change to something about this library, this is going to become embarassing :-/
At least :
before-mutation
: (state, mutationPath, args)
after-mutation
: (state)
after-microtask-mutations
: (state)
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.