chrants / react-list-keys Goto Github PK
View Code? Open in Web Editor NEWA Natural Solution for React list keys
License: MIT License
A Natural Solution for React list keys
License: MIT License
Export a default keygen, in addition to the ReactKeyGen class.
The undocumented keyNo
object property on ReactKeyGen instances is exposed and serves no good purpose to the end user atm other than maybe causing bugs
There are many types of things in lists that you might want to generate keys for, not just objects -- primitives like string or integer as well. Right now it's possible to use the string or integer as a key because they are primitives BUT in something like a to-do list or list of text messages, you must first wrap it in an object if you want the lists to have duplicate values, which in these cases they very well might.
An idea is to add a wrapper or something over a primitive list to generate keys or something for primitive list items. One solution might be to have a key as a string with something dumb like ${value}${indexInList}
but that kinda defeats the whole purpose of handling keys properly. Another solution that might work is to wrap the primitives in an object with its valueOf()
returning the primitive value, and then adding a _key
property.
Primitive support should include at least:
Optional support could be added for:
NPM currently does not syntax highlight the code example. Changing the script body to 'javascript' instead of 'node' might 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.