1

After updating Primereact to 8.3.0 document.getElementById() is returning null for div in primereact accordion created in return of jsx. I was able to access the div returned by the primereact accordion in previous version of primereact 3.4.0. React version is same in both cases that is 16.8.3

I would like to know how do I access the div returned from primereact accordion using document.getElementById() in componentDidMount.

Aditya
  • 11
  • 1

1 Answers1

2

PrimeReact 8.3.0 requires React 17 or greater and you are using 16.8.3.

See: https://primefaces.org/primereact/setup/

Please note that react >= 17.0.0 and react-dom >= 17.0.0

Melloware
  • 10,435
  • 2
  • 32
  • 62
  • Thank you for the response. I tried updating the react version to 17.0.0 but still I am not able to access the div using document.getElementById(). Can you please suggest any other solution for the above issue? – Aditya Jul 31 '22 at 07:05
  • Can you post your exact code and what you are doing or make a Code Sandbox reproducer: https://codesandbox.io/s/primereact-test-forked-bbns8k – Melloware Jul 31 '22 at 12:41
  • I am having a div inside a primereact accordion as given below: { this.reqPalClick(this.floatwinConfig.content) }}>
    In the above code there is a div with id "accordionDiv1". I want to access this div using document.getElementById in componentDidMount method of jsx
    – Aditya Jul 31 '22 at 13:46