react-id-generator icon indicating copy to clipboard operation
react-id-generator copied to clipboard

Having multiple sequence streams

Open Snedden opened this issue 6 years ago • 2 comments

Does this have the option of having multiple sequence streams, for example

nextId('localid1-', stream1) = localId1-1 nextId('localid1-', stream1) = localId1-2 nextId('localid2-', stream2) = localId2-1 nextId('localid2-', stream2) = localId2-2 nextId('localid1-', stream1) = localId1-3

If so can someone tell me how I can do this,or include it in the documentation . If not can we have this feature?

Snedden avatar Oct 10 '19 12:10 Snedden

Hi @Snedden we don't have such a feature at the moment, any reason you need something like this?

Tomekmularczyk avatar Oct 10 '19 12:10 Tomekmularczyk

@Tomekmularczyk Well I think I have this use case where I think I need something like this,

I am working on a pet project of mine where the user can make a visual tree and add nodes to the tree, I am using nextId as the user adds a nodes/children to a tree, so the names of the nodes are child1, child2, child3 and so on..

now each node has properties which the user can alter and also add so when user selects on say child1 , he should be able to add property like key1, key2, key3, although when he adds properties for some other child/node say child2 the keys would again be like key1,key2,key3.

I can write a small functionality for this but was thinking of using nextId as I am already using if to increment children i.e. child1,child2,child3 .Thought its better to use the same functionality everywhere.

Snedden avatar Oct 10 '19 12:10 Snedden