Comments (5)
- 1 and 2:
initData
is just some data that is shared to all created list items. I use it for example to provide references to i18n or api:
class Item {
constructor (initData, data, i, data) {
console.log(initData); // 'Hello'
console.log(data); // 1, 2, 3, 4, 5
console.log(i); // 0, 1, 2, 3, 4
console.log(data); // [1, 2, 3, 4, 5]
}
update (item, i, data, context) {
console.log(item); // 1, 2, 3, 4, 5
console.log(i); // 0, 1, 2, 3, 4
console.log(data); // [1, 2, 3, 4, 5]
console.log(context); // 'yo!' –> similar to initData
}
}
const items = list(Item, null, 'Hello');
items.update([1, 2, 3, 4, 5], 'yo!');
- 3:
listPool
really rarely needed, I decided to remove it from the docs for now
–> you could create a customlist
component with it, like animated list for example - 4: I agree
- 5:
setChildren
will callmount
andunmount
as needed, yeah - 6: I agree
Thank you so much, these are really helpful comments! 👍
from redom.
Yeah, it's a bit confusing right now, since fat arrow functions converted to regular functions by bundlers like Rollup+Buble or Babel will work..
from redom.
Well I think it should be added somewhere in the docs to help people trying the lib.
Actually there are various places where the documentation is lacking making the library a little difficult to use.
from redom.
I'd love to hear your thoughts about the documentation or specific pull requests / issues even better 😊
from redom.
Some quick ones (I can't do a PR since I can't answer most of the following myself):
- I couldn't find any documentation for the
initData
parameter oflist()
. I understand that this is passed to the constructor of thelist
view component but how it can be used? An example would be useful here. - Continuing from the above, I can understand that there are a bunch of parameters that
list
passes to the component when creating it (including theinitData
). However I couldn't find them listed in the docs. - I think that you need to add a rationale for
list
and more importantly forlistPool
andplace
. I really can't understand what's the purpose oflistPool
; what does it offer, why should I use it? This can just be one or two lines but it is very important for people not familiar with the library. - The
router
function needs a better and more complete example. - What is the difference between
mount
,unmount
andsetChildren
? I've observed that if I call mount multiple times (each time mounting a newel
) it will append the list of elements to the parent. On the other hand if I call setChildren it will replace the parent's dom with the new element. Is this their only difference? WhillsetChildren
callunmount
? - Also it would be great if you add a little more complex example, i.e the classing Todo list.
I can understand that most of these question could be answered by trial and error or by reading the source code. However it is not easy for everybody to do these things especially with the abundance of JS framework existing right now.
from redom.
Related Issues (20)
- `value` property for <select> is not handled properly HOT 3
- redom is removed by babel when using jsx HOT 1
- Attributes leaking to el item of component HOT 4
- Possibly incorrect/incomplete type definition for lists HOT 5
- URL Router HOT 3
- RE:DOM SPA framework inclusion into the redom organization HOT 3
- reusing created element with el in multiple locations HOT 2
- Explicit Table Creation Example HOT 6
- Idea: Auto map update HOT 6
- Problem to render a component HOT 13
- mount with replace option HOT 9
- create a list without specify parent element HOT 1
- View is not a constructor HOT 1
- write HTML tags when creating an element HOT 1
- ESM builds are ES5, not ES6 HOT 2
- mount into a dom element by selector HOT 3
- Version 3.29.0 Introduces breaking changes HOT 1
- List update after sorting data HOT 2
- readonly attribute HOT 8
- Is there any standard project template available for redom? HOT 8
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 redom.