We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

onClick not working in function component


onClick event is not working in this component (20.3.56)

import React from 'react'
import {FabComponent} from '@syncfusion/ej2-react-buttons'
import {createRoot} from 'react-dom/client'
import PropTypes from 'prop-types'

export default function FloatSaveButton({target}) {
const test = () => {

return <FabComponent id="fab"
iconCss="fas fa-save"
onClick={() => test()}

FloatSaveButton.propType = {
target: PropTypes.string.isRequired

const el = document.getElementById('reactFloatSaveButton')
if (el) {
const target = el.getAttribute('target')
const root = createRoot(el)
<FloatSaveButton target={target} />

1 Reply 1 reply marked as answer

NV Navin Vinayagam Syncfusion Team December 8, 2022 09:53 AM UTC

Hello Julien,

We checked the reported issue by preparing a simple sample, but the click event worked as expected in the sample.

We have attached the sample link for your reference.

Sample: https://stackblitz.com/edit/react-ts-brpe8u?file=App.tsx,style.css,package.json,index.html

Can you share an issue reproducing sample or modify the above sample to reproduce the issue? This will be helpful to check the issue from our end and provide you with a prompt solution.


Navin V

Marked as answer
Live Chat Icon For mobile
Up arrow icon