Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
36 views

My app structure is: A root layout (app/layout.tsx) A shared Header component, rendered on all pages (including static pages like home/about) Inside the header, an AuthButtons component that should ...
Abode Explorer's user avatar
Best practices
1 vote
3 replies
141 views

I’m building a React + TypeScript app and using Axios for API requests. I have an AuthProvider using React Context to manage the user and token, and I’m running into a few questions and issues: Do I ...
JesSy's user avatar
  • 1
Advice
0 votes
4 replies
92 views

I am trying to move to RTK Query, but am struggling with one thing - how to access React Context. I currently am using custom hooks to query a back end. Depending on the environment (dev, uat, prod), ...
vegemite4me's user avatar
  • 6,956
2 votes
1 answer
111 views

This is my structure about code: src App.js pages ConfigurationPage.jsx provider ConfigurationProvider.jsx context ConfigContext.jsx Explain bug: The code is executed 2 times in provider. The ...
ArthurArmand's user avatar
0 votes
1 answer
81 views

import { createContext, useContext, useState, useEffect } from 'react'; import { Appearance } from 'react-native'; import { lightTheme, darkTheme } from '../utility/theme'; type ThemeType = typeof ...
Sagar Sharma's user avatar
0 votes
0 answers
89 views

My turborepo has several packages, one of which is a ui library that uses some context providers. I export these context providers (Theme, Toast, etc.) so that I can use my UI components in my apps ...
Bigboss01's user avatar
  • 628
0 votes
0 answers
54 views

if I login with wrong username or password the server (NextJS) will return error message with status code 401, what should happen in this case is that !res.success will be executed and it's indeed ...
Morgana Freeman's user avatar
0 votes
1 answer
95 views

I'm building a React app with React Router and a context provider that loads property data based on a propertyId route param. In my App.jsx, I have the following routes: <Route path="/edit/:...
user25038396's user avatar
0 votes
1 answer
100 views

When I make a component that relies on something like the currently chosen language for example, or maybe a special query function to fetch data, and I provide either of these things via a ...
ADJenks's user avatar
  • 3,484
1 vote
1 answer
76 views

In my Expo React Native application, I have a context variable (trackingAsked) that is also a state variable that I use to display a different opening screen. Everything works fine. On power up, the ...
rjapenga's user avatar
  • 255
0 votes
1 answer
58 views

I need to save the ID of a field from the settings.tsx view. That value need to be used with other view, like stations.tsx, alarms.tsx, map.tsx. If later, I need to watch another field, I can change ...
popof's user avatar
  • 3
0 votes
1 answer
55 views

I am a novice and I need to use a parameter for all view/page of my React Native App. Scenario: from my setting.tsx view, I can select a field as a preference. From the stations.tsx view, I use ...
popof's user avatar
  • 3
1 vote
1 answer
81 views

Although the docs for context say "React automatically re-renders all the children that use a particular context starting from the provider that receives a different value.", from my testing ...
Drew Gallagher's user avatar
-1 votes
1 answer
64 views

Why do I need to write .Provider? It works perfectly both with and without it. Code below works: import { useState, useEffect, createContext, useContext } from "react"; const ThemeContext = ...
Coder4Fun250's user avatar
2 votes
1 answer
80 views

In my React Native app, I'm having a problem where the setState function is not being recognized as a function. I already inserted the context provider on the App root page and exported the context ...
Vivantt's user avatar
  • 43
0 votes
1 answer
81 views

Basically what title says. I want to know if there is any package or other way to declare a context to get data from it (I don´t need to modify that data) without having to declare a provider, a type ...
Horacio García Magallanes's user avatar
1 vote
1 answer
91 views

I'm working on a complex analytics dashboard built with React and TypeScript, which involves multiple nested components. I'm using a combination of state management techniques including React Context, ...
Daniel James's user avatar
4 votes
1 answer
375 views

Looking at the React documentation for Context, the context is used without the .Provider property: import { LevelContext } from './LevelContext.js'; /* LevelContext is defined as export const ...
Lukas's user avatar
  • 69
-1 votes
1 answer
52 views

I created an auth context and set the object to an initial state, then after wrapping the App() with the provider, I am trying to modify the authContext in 1 (Home.js) component and then try to access ...
omar watad's user avatar
3 votes
2 answers
67 views

I'm trying to set up a context from a custom hook. Here's my code: usePlayerInterface.jsx import { useState } from 'react'; export function usePlayerInterface() { const [userAction, setUserAction] =...
Rooster242's user avatar
  • 1,016
0 votes
1 answer
112 views

I'm trying to set up a form with many rows of data, with each individual items. When I click a button, I want to get all of the data from each children, and submit the form. I'm using context to ...
Chris Jeong's user avatar
-1 votes
2 answers
228 views

Original Question I am trying to learn more about the inner workings of React, and here specifically Context Providers so I don't have a use-case in mind, just trying to understand why it works the ...
culicidae's user avatar
0 votes
0 answers
61 views

I have setup a state in the context using a reducer const playerStateReducer = ((state: PlayerState, action: PlayerAction) => { switch (action.type) { case "SET_LOCATION": { ...
Marko Taht's user avatar
  • 1,548
0 votes
0 answers
79 views

I've created an app that stores user information in firebase. The main profile page consumes the data via a hook that retrieves the data from firebase/storage. What I'm trying to do in this page is ...
D.Hodges's user avatar
  • 2,129
0 votes
1 answer
57 views

I am attempting to implement the React useContext hook to share the state of a user license. I've found this pattern online but can't seem to get it to work. If the license is not valid, the user is ...
JediPotPie's user avatar
  • 1,068
0 votes
1 answer
132 views

I'm attempting to fetch the data from user once the page loads. Although, currently when there is any route changes, it triggers my useEffect and calls the fetch user endpoint which causes my loading ...
Nilton Schumacher F's user avatar
1 vote
0 answers
50 views

I'm working on a framework that allows developers to create extensions for a main app. Extensions can add components to different parts of the app layout, such as the sidebar or workspace, ...
Ritesh Shakya's user avatar
-1 votes
1 answer
64 views

I have this handler and function to update my react context but it's not updating. It does not dispatch the action This function switches accounts const loadAccountSwitch = useCallback( async (...
lutakyn's user avatar
  • 474
0 votes
1 answer
37 views

I created a NewsContext for my React project for accessting static data: NewsContext: "use client"; import { createContext, useContext, useState, useEffect } from "react"; export ...
Lvkas_'s user avatar
  • 23
-1 votes
3 answers
169 views

I have tried to use useEffect to store user details in local storage but unable. Please do any help on it. Full Code : const AuthContext = createContext() const AuthProvider = ({ children }) => {...
Abhishek Kumar's user avatar
0 votes
1 answer
115 views

Description I encountered a problem while using the Next.js App Router (version 14.2.6). The issue occurs only in the production environment. it works perfectly fine in the local environment. I'm ...
D uuu's user avatar
  • 1
0 votes
0 answers
111 views

I have an Electron-Vite React (TSX) application. I am pretty new to coding Electron-Vite-React; perhaps my problem is because I am not understanding all the subtilities of certains concepts... I have ...
Alexandre Landry's user avatar
0 votes
1 answer
31 views

I am using Next.js (which is React based framework). I want to force download some files, so I created custom context for that. "use client"; import { createContext, useContext, useRef } ...
splash27's user avatar
  • 2,127
0 votes
1 answer
59 views

I want to fetch the data by running the API in the useContext() api, basically this API gives me the number of items added in the cart and I need that number only which Im using it in Cart.js ...
Mohit's user avatar
  • 137
0 votes
1 answer
84 views

I am trying to avoid prop drilling in my Solid application, but contexts all return undefined or my check throws an error. SettingsContext.tsx import { createContext, useContext, createSignal, ...
zalnars's user avatar
  • 25
-3 votes
1 answer
59 views

I've been out of the frontend js scene for a while, and now try to catch up on React etc. I don't really get contexts. First you need to create a context somewhere, then you can use <Context....
tonsteri's user avatar
  • 877
0 votes
0 answers
47 views

I have created a context and I want to change it when I click in SingleProduct component button but it doesn't work I have ctreated my context in a .ts file DataModalContext.ts: import { createContext ...
Mohammadreza Hozoori's user avatar
1 vote
1 answer
36 views

I need to use attendance data often on my website, So I make it as utility as below: import React, { useState, useEffect, useMemo, useCallback, createContext } from 'react'; import { ...
BI IYI's user avatar
  • 11
1 vote
1 answer
255 views

I am trying to implement dynamic debug logging by populating a ThreadContext with specific attributes and filtering logs based on those attributes. Here’s what I have achieved so far: Within the same ...
Rahul verma's user avatar
2 votes
2 answers
81 views

I am trying to create a parent/overarching context. The purpose of the context is to store UserInfo which should then be available to all children. UserInfo is set by getting config from an API. ...
Oam Psy's user avatar
  • 8,663
1 vote
2 answers
2k views

I'm experiencing a challenge with React Hook Form where my child component InputX re-renders every time there's an update in the parent component or other parts of the application, despite no changes ...
Mustafa's user avatar
  • 979
3 votes
0 answers
464 views

Playing with a store in Next.js 15 and using React 19 I'm running into an issue with my cart context and keep receiving a hydration error of: An optimistic state update occurred outside a transition ...
GʀᴜᴍᴘʏCᴀᴛ's user avatar
-1 votes
1 answer
43 views

I have been trying to understand how to populate my modal with asynchronous data and not cause the parent page to rerender. I have tried making a separate context for the modal, moving modal out of ...
Daniel Brusky's user avatar
-1 votes
1 answer
48 views

I'm trying to write and context to set an id in local storage . Here's my code import React, { createContext, useEffect, useMemo, useState, ReactNode, } from 'react'; // Interface pour le ...
ikiou's user avatar
  • 1
1 vote
2 answers
38 views

I'm developing a React Native app with TypeScript and using Firebase for data storage. In my app, I have a context provider (NatureRecordProvider) that should wrap two main screens, NatureRecordForm ...
000 000's user avatar
  • 23
0 votes
4 answers
116 views

I'm trying to create a context whose default value will come from an external source. I would need to do something similar to doing the fetch outside of an asynchronous function (I don't think this is ...
Thiago Barboza's user avatar
0 votes
1 answer
239 views

I have a RootStack that I'm trying to wrap so I have access to my user object(s) and it's not updating like it did when I had it bare. Is this wrong? main _layout file import { useEffect } from '...
Joel Hager's user avatar
  • 3,478
1 vote
2 answers
166 views

I am trying to implement dual theme (dark & light) in Next JS using MUI using use context method. It gives me this error: ⨯ src\app\page.tsx (6:50) @ useThemeContext ⨯ TypeError: (0 , ...
Muhammad Sharjeel Maqsood's user avatar
0 votes
1 answer
97 views

I am attempting to update state using a context provider. I cannot figure out where I am going wrong. The state simply doesn't update. If anyone could point me in the right direction or suggest ...
Mick's user avatar
  • 3
0 votes
1 answer
136 views

I am trying to set data of context. context : import React from "react"; const AppContext = React.createContext<IContext>({} as IContext); export default AppContext; In App.tsx file I ...
hmahdavi's user avatar
  • 2,400

1
2 3 4 5
73