react-context Questions
1
Solved
I understand hooks can only be called inside the body of a function component but I was wondering if there is a way to access context data from inside react-router@6 action function. I have an acti...
Gentianella asked 21/3, 2023 at 22:0
6
Solved
I am using the new React Context API and I need to get the Consumer data from the Context.Consumer variable and not using it inside the render method. Is there anyway that I can achieve this?
For ...
Taker asked 17/4, 2018 at 4:44
5
Solved
FOREWORD / DESCRIPTION
I am trying to use React's new hooks feature for an e-commerce website that I am building, and have been having an issue working a bug out of my shopping cart component.
I ...
Miguelmiguela asked 8/3, 2019 at 2:17
4
Solved
I have a react web app with a theme toggle on the navigation. I have a ThemeProvider Context that has logic to auto detects a user's System theme preference and sets it. However, I feel a user shou...
Franko asked 9/4, 2020 at 9:7
4
Solved
Next13 was released a week ago, and I am trying to migrate a next12 app to a next13.
I want to use server-side components as much as possible, but I can't seem to use
import { createContext }...
Kristiankristiansand asked 4/11, 2022 at 1:56
4
I am looking for a solution for using a global screen loader in react.
I am not that much familiar to react context, but I was wondering if that could help me here.
Basically I am introducing a scr...
Chatham asked 12/3, 2021 at 0:40
2
Solved
I'm building an app with Next.js 13 and Supabase for the backend, and I've been stuck on figuring out the best/proper way to go about creating a context/provider for the current logged in user.
The...
Dissatisfactory asked 2/12, 2022 at 21:28
3
Solved
So I'm having a very weird issue with React Context + Typescript.
Working example
In the above example, you can see what I'm trying to do actually work. Essentially I'm managing state with the n...
Jenette asked 7/2, 2019 at 16:26
1
Solved
In the project I'm creating a React Contex and I want to type properly the children, unfortunately in codesandbox only "any" type is accepted. Can You please look at it and suggest what t...
Borreri asked 23/12, 2022 at 22:50
1
I am using Cypress for integration testing (not for unit testing / component testing) and working with application that has authentication logic depending on the presence of a security token in the...
Akimbo asked 25/5, 2021 at 12:58
2
Solved
can someone explain to me why the next code re renders all children components from the provider
import { createContext, useContext, useState } from "react";
const ThemeContext = createC...
Ruche asked 9/1, 2021 at 2:22
4
Solved
I'm using React's context api to store an array of items. There is a component that has access to this array via useContext() and displays the length of the array. There is another component with a...
Rerun asked 8/9, 2019 at 2:55
2
Solved
I'm trying to use a snackbar component that takes an open and message prop and that I can display (set open to true) from any page of the app.
From what I understand I should use Context. But I'm n...
Jackqueline asked 11/12, 2020 at 18:17
1
I have a project with nextJs and typescript. I used context API for handling global states in my application. My problem is when I navigate between pages my state revaluates again.(i used nextjs Li...
Chelseachelsey asked 24/1, 2022 at 7:15
2
how do i wrap 2 routes in a context in react router v6?
only these two should be exposed to that context and i cant set the context separately because the context runs some code(useEffect) and if i...
Naked asked 26/6, 2022 at 18:2
2
Every example I've seen of React context is like this:
theme-context.js
// Make sure the shape of the default value passed to
// createContext matches the shape that the consumers expect!
export ...
Monochromat asked 20/7, 2019 at 9:6
1
Solved
I have a context, I import it into my functional component:
import { TaskContexts } from "../../../contexts";
The context stores data and functions.
The data comes from the context and i...
Stallion asked 1/6, 2022 at 20:9
1
I am trying to call the currency according to the properties given in the context API, but whenever I call it will get Error: TypeError: Cannot read properties of null (reading 'useContext'). But w...
Unperforated asked 12/5, 2022 at 7:26
3
The issue I’m facing though is that I want to mimic the behaviour of the FlaskLogin current_user in React throughout the component treed. For anyone that’s not familiar with FlaskLogin, current_use...
Porterhouse asked 27/3, 2019 at 21:48
3
In the quick start docs of react-query here there is the following example:
// Create a client
const queryClient = new QueryClient();
const App = function () {
return (
// Provide the client to ...
Kerry asked 19/3, 2022 at 18:34
2
I was creating an online shopping website and tried to use React Typescript for that project,
but when I tried to work with Contexts I couldn't fix this problem when I try to export my state in the...
Wire asked 8/6, 2021 at 12:5
3
Solved
I am trying for the first time to use React context API to pass information from a main component to a grandchild component.
So first I have created a context
const MyContext = React.createContext(...
Fimbriation asked 17/4, 2019 at 14:39
2
Solved
The useSWR hook from swr works everywhere if I explicitly enter the fetcher.
const { data } = useSWR("http://...", fetcher);
However, if I used swr global configuration as shown below, t...
Tautologism asked 22/10, 2021 at 17:56
4
I've built a ReactJS component library that I use for multiple projects installed via an NPM package using a sim link. I want to use the context API to pass data from a parent component served from...
Sungkiang asked 17/9, 2019 at 14:39
3
Each time when onClick executes I received a warning message about memory leak. How component can be can unsubscribed from the Context.Consumer in my functional component with useEffect hook?
I di...
Northamptonshire asked 13/6, 2019 at 15:41
© 2022 - 2024 — McMap. All rights reserved.