Sitemap
Technology Hits

We cover important, high-impact, informative, engaging stories on all aspects of technology. Subscribe to our content marketing strategy newsletter: https://drmehmetyildiz.substack.com/ Apply via: https://digitialmehmet.com/contact External: https://illumination-curated.com

Coding Chronicles #3 | React TypeScript onClick | Expected `onClick` listener to be a function, instead got a value of `object` type.

3 min readJan 6, 2024

--

onClick event expects a reference to the function.

Press enter or click to view image in full size
Photo by Lautaro Andreani on Unsplash

A usual day in the life of a software programmer brings out many coding challenges. Most of these challenges need a few minutes of online search. I started a series of mini blogs dealing with some of these challenges a few days back. The complexity of these challenges will range from average to complex.

This article addresses a React TypeScript issue following previous articles on Playwright problems.

Use Case

I am currently writing an upload functionality. A bin icon is present next to each file. With the click of the bin Icon, a type script method calls a GraphQl API. The GraphQl API handles the file deletion logic.

Press enter or click to view image in full size
Snapshot taken from personal laptop

I don’t have much experience with React. Hence, I started reading about the onclick event listener.

The first solution I got was:

onClick={handleDeleteFileClick(fileName)}:

--

--

Technology Hits
Technology Hits

Published in Technology Hits

We cover important, high-impact, informative, engaging stories on all aspects of technology. Subscribe to our content marketing strategy newsletter: https://drmehmetyildiz.substack.com/ Apply via: https://digitialmehmet.com/contact External: https://illumination-curated.com

tarun bhatt
tarun bhatt

Written by tarun bhatt

Learning to write and share. #ITNerd #MentalHealthAdvocate #MenRightsActivist #ToastMaster #PublicSpeaker

No responses yet