Comments (1)
Excellent points!
You are correct, we are mutating the object, and we have set up a controlled way of re-rendering the view on the same object, using streams to control when the re-rendering occurs.
Later on, when using a stream of functions for updates, the nesting function is:
var nestUpdate = function(update, prop) {
return function(func) { // this is the nested update. take the incoming func, and
update(function(model) { // call the original update, and
model[prop] = func(model[prop]); // call func on the nested model
return model;
});
};
};
Again, we are mutating model
and returning it.
The Meiosis pattern works well both with mutation and immutable objects. Because we have set up a clear, unidirectional reactive loop, mutation is unlikely to cause bugs. I did not want to prescribe immutability because it is not required for the pattern to work well.
Object.assign
is used to gradually explain the concept of a stream of updates, working our way up to using a stream of functions for updating the model. Once reached, utilities such as Ramda and Lodash-FP can help with producing new objects instead of mutating existing ones. I have sections on these libraries in the Documentation. But again, I don't want to imply that immutability is a requirement.
As you said, there are some functional programming patterns that rely on immutable objects. Indeed I am trying to teach some FP concepts because they are useful with Meiosis, but there's nothing wrong with using mutation.
Thank you for your feedback, I appreciate it!
from meiosis.
Related Issues (20)
- How to integrate it into a redux app HOT 4
- All the documentation removed? HOT 1
- Tutorials for react deleted HOT 1
- Example Implementation HOT 1
- About React Hooks and meiosis state HOT 1
- SAM Pattern nap issue HOT 6
- Brilliant! HOT 5
- more food for thought HOT 3
- Error on auth redirect HOT 2
- params handling HOT 7
- subtle routing bug HOT 6
- Convert to Mergerino HOT 2
- Routing helper broken when used with mithril router without the prefix
- Feature request: bind actions to Actions object HOT 3
- examples with react-hook (or solidjs state) HOT 4
- meiosis-setup with snowpack? HOT 1
- How to turn off a "map" callback? HOT 5
- Alternative way of connecting stream to React function components HOT 2
- Question on initialRoute HOT 8
- meiosis-setup with typescript: some suggestions HOT 7
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 meiosis.