-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Needs investigationRequires research whether this is an issue with the library or example to reproduce.Requires research whether this is an issue with the library or example to reproduce.
Description
This is similar to #1, but works in a single DOM render and doesn't require streaming.
Because the iterator is trapped within the scope of the specific class, it doesn't populate across components, so isn't safe to use for globally unique IDs on a page.
fooA.js
import React from 'react';
import nextId from 'react-id-generator';
export default class FooA extends ReactComponent {
id = nextId();
render() {
render(
<div id={id} />
)
)
}
fooB.js
import React from 'react';
import fooA from './fooA';
export class FooB extends React.Component {
render() {
return(
<React.Fragment>
<FooA />
</React.Fragment>
}
}
fooC.js
import React from 'react';
import nextId from 'react-id-generator';
export class FooC extends React.Component {
id = nextId();
render() {
render(
<a id={id} />
)
)
}
template.js
import FooB from './fooB';
import FooC from './fooC';
<FooB something={'something'}/>
<FooB something={'something else'}/>
<FooC />
Expected Result
<div id="id1"></div>
<div id="id2"></div>
<a id="id3"></a>
Actual Result
<div id="id1"></div>
<div id="id2"></div>
<a id="id1"></a>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs investigationRequires research whether this is an issue with the library or example to reproduce.Requires research whether this is an issue with the library or example to reproduce.