Skip to content

Tag: reactjs

How to convert an array of strings into a number?

I’m fetching data from an API which returns currency exchange rates like so: I was able to manipulate the fetched data using: const rate = Object.values(data).splice(11,5); which returns 1.044 However, my next problem comes when trying to parseFloat this object into a number.. for some reason it only re…

how to make tailwind utility class dynamic

I want to create a simple square using tailwind, but I want to make the class dynamic Answer TailwindCSS doesn’t allow you to generate classes dynamically. So when you use the following to generate the class… …TailwindCSS will not pick that up as a valid TailwindCSS class and therefore will not produce …

map through an object and fill another object

I am trying to map through the data.scales array of objects and display the values in the obj createvalues array as shown in the output. I cannot quite figure this out. I have to make sure I do not delete the values existing in the createValues array The output expected is this one : Answer

UseEffect only works after refresh the page

I am using an useEffect inside a Context. I think the useEffect should run after load the page, but it does not work, but if I refresh the page(F5) then it works. I am new Using React, but I think it should work with the empty array as arg. This is the Context: EDIT: Now I realized that the problem