diff --git a/hooks/src/index.js b/hooks/src/index.js index 70e0f265a3a..d05947eaaf8 100644 --- a/hooks/src/index.js +++ b/hooks/src/index.js @@ -378,7 +378,7 @@ export function useId() { } let mask = root._mask || (root._mask = [0, 0]); - state._value = 'P' + mask[0] + mask[1]++ + currentIndex; + state._value = 'P' + mask[0] + '-' + mask[1]++; } return state._value; diff --git a/hooks/test/browser/useId.test.js b/hooks/test/browser/useId.test.js index c8aa3e1d0b0..e7fc7f947b7 100644 --- a/hooks/test/browser/useId.test.js +++ b/hooks/test/browser/useId.test.js @@ -55,12 +55,12 @@ describe('useId', () => { render(, scratch); expect(scratch.innerHTML).to.equal( - '
h
' + '
h
' ); render(, scratch); expect(scratch.innerHTML).to.equal( - '
h
' + '
h
' ); }); @@ -83,12 +83,12 @@ describe('useId', () => { render(, scratch); expect(scratch.innerHTML).to.equal( - '
hhh
' + '
hhh
' ); render(, scratch); expect(scratch.innerHTML).to.equal( - '
hhh
' + '
hhh
' ); }); @@ -121,13 +121,13 @@ describe('useId', () => { render(, scratch); expect(scratch.innerHTML).to.equal( - '
h
' + '
h
' ); set(true); rerender(); expect(scratch.innerHTML).to.equal( - '
hh
' + '
hh
' ); });