I want to pass a function that returns string to set the className
of an element by this string in reactjs.
I tried something like this but it didnt return anything:
className={() => shift.spots === 0 ? "notassigned" : "filled"}
As JLRishe pointed out in his comment, you should not use a function but a simple statement instead
className={shift.spots === 0 ? "notassigned" : "filled"}
You need to invoke your function.
return (
<div
className={(() => shift.spots === 0 ? "notassigned" : "filled")()}
/>
);
Or else you are passing an arrow function to className.
Controller Advice bean not instantiated at proper order in Spring Boot 2.4
What should I enter to the connection string to connect my NodeJS application to a MongoDB server?
Unable to use Computed Property Values with Dots - Unable to Set as String - JS
I have an array of addresses which I need to convert to coordinates lat and long using Google Geocoding service
It's my first project on C#avec i would like link my DataBase MySQL with my projectI tried with EntityFramework but after choice my DB the windows closed for no reason
I am trying to connect mysql but not working:
I can scan the Beacon in foreground using beaconManagerstartScan(); so it is giving the beacons info available in the area