Adding custom components in header not working as expected

Hi Team am trying to add custom components on header like what mentioned in documentation.

but whenever I use useState or useEffect on my custom component it resulting in following error

Please help me to resolve this

Thank you for posting the incident to our forum. We will provide you with an update as soon as possible.

Hello achandran,

This does not look like it is related to PDFJS Express. If it is, please provide additional information!

Best regards,

Pleas take a look at this,
in slider component if am using any hooks(useState, useEffect) an getting that error, if I remove hooks there wont be any errors