I recently integrated the preline UI library into my React project to enhance the design of my website. However, I encountered an issue where using the "select" element with the data-hs-select attribute as suggested by preline UI seemed to cause problems with onChange and onClick events. Strangely, nothing was triggered in the console when these events were fired. Despite this, the selected value was displayed correctly on the browser interface. Interestingly, I was able to retrieve the selected value using useRef or document selector methods.
Even after attempting to solve the issue by using formik field [as='select'], the problem persisted.
<select
name='Country'
data-hs-select='{
"hasSearch": true,
"searchPlaceholder": "Search...",
"searchClasses": ...
}'
className='hidden'
onChange={() => console.log('option clicked')}
>
<option value=''>Choose</option>
<option value='Australia'>Australia</option>
<option value='Canada'>Canada</option>
<option value='France'>France</option>
<option value='Germany'>Germany</option>
<option value='Italy'>Italy</option>
</select>