Skip to content
Advertisement

Tag: react-hooks

global React functions that utilize hooks

I have a function called scheduleShortcut that gets used in a couple places throughout an application. Initially, this function was local to the specific components but since it is being used multiple times, I want to refactor this function into a global function. At first, I tried to do the following: However, when I do this, I get an error

React Hooks useState array storage problem

I have the following problem: I have a method that returns a multidimensional array in my Grids component. I would want to store any multidimensional array recomputed in a separate list. The problem is that when I am using my useState() declared in this way only the current state element is saved repeatedly in the array list. Follow the code

React JS sorting issue

I’m trying to sort some data in my application. I’d like to support the following options: Price (low to high) Price (high to low) Mileage (low to high) Mileage (high to low) It looks like price sorting is working. However, when I click on “lowest mileage”, it keeps showing the highest price results – the old value of sorting. I

React connecting info between App.js and a class

I am trying to integrate React Scheduler into my app that uses JSON data base. how can I pass the shifts and functions defined in App.js that update the data to DataSheet.js and use them instead of the defaults? Is there a better way to enable the database update from the DataSheet? App.js: DataSheet.js: Answer Pass the data as props

Next.js context provider wrapping App component with page specific layout component giving undefined data

I have an auth context component where I’m wrapping my main app component, but at the same time I’m also trying to do page specific layout component per Next.js documentation here: https://nextjs.org/docs/basic-features/layouts#per-page-layouts Am I doing this correctly, because I can’t seem to be getting the data from my Context provider. /context/AuthContext.js /_app.js /components/Project/List.js I’m trying to console log the user,

Advertisement