Relative Content

Tag Archive for javascriptreactjsreact-hooks

useState to hide elements in Navbar?

I want to hide some links in my Navbar. There are three different types of user, and each of them will see some other links on the navbar. For example:

Where does useHistory hook store data

Recently I was working on a bug which requires me to identify if the user explicitly reloaded the page. Whenever user make any request I create a new search id (which is just the hash of the request) and push it into the useHistory and set the state to the request body

ERROR Cannot read properties of undefined (reading ‘AUD’)

I am making a currency converter app. My issue is in my function Currency Converter. The AUD that I have as a string in the useState is not being read after i launch the app. I am not sure why as the code was working this morning. But I added a variable and function to convert after someone inputs an amount and that’s when I received the error.

React: “.map is not a function”

I am building my first React app using Java Spring for the backend. I encountered an issue while trying to fetch data from the API and map it in js. It gives me the error fireteam.map is not a function. Here is the problem code:

How to reassign value of color manually with ‘react-color-palette’?

I’m trying to incorporate react-color-palette into my page, I’m just not sure how to reassign the value of color outside of clicking on the color picker element. I’d like to have another function or event that can also change the color value without user input and reflect the changes on the color picker.