react-context Questions
2
Summary:
1) Do you know how to keep the state of a Context Provider present when it is mounted/unmounted through routing?
2) Or do you know a well maintained Flux implementation that supports mult...
Bamford asked 10/6, 2018 at 3:25
2
Solved
I'm wondering what the recommended best practice is for manipulating and exposing the new React Context.
The easiest way to manipulate context state seems to be to just attach a function to the co...
Felicio asked 21/4, 2019 at 21:6
2
Solved
I'm trying to use the new Context API in my app and it looks like every time I update the context, it re-renders any component connected to it regardless. I have a sandbox demo setup to see code an...
Tempestuous asked 8/7, 2018 at 16:13
1
I have an application without redux, I handle the global state with hooks and the hook useReducer + context. I have 1 useReducer which makes like a Redux store. But to do this I can only send 1 red...
Magi asked 10/4, 2019 at 19:55
2
Solved
I have implemented React Context API and I am trying to update the state defined inside the Provider via an onClick function inside a child component.
This is what I have done so far, in the App.j...
Boo asked 20/3, 2019 at 17:12
2
Solved
I'm trying to get react context working with SSR. This is what I have
// server/index.s
import express from "express";
import serverRenderer from "./middleware/renderer";
const PORT = 3000;
const...
Kohl asked 14/3, 2019 at 8:43
2
Solved
I searched for an answer but could not find any, so I am asking here,
I have a consumer that updates the context,
and another consumer that should display the context.
I am using react with typesc...
Carousal asked 22/2, 2019 at 16:33
1
Solved
I am writing a basic CRUD React app that uses Firebase for authentication. At the moment I am trying to create a protected route for a component named Dashboard. The protected route insures that an...
Tetrameter asked 8/2, 2019 at 4:57
1
Solved
I'm trying to add simple React Context to my app. I create Context in "./components/DataProvider.js" that looks like this:
import React, { Component } from 'react'
const DataContext = React.creat...
Taperecord asked 24/1, 2019 at 20:14
1
I am learning about the somewhat newly introduced React.Context API, but I've noticed some inconsistencies on it's consumption across examples. Some use the original Context.Consumer HOC method, wh...
Magen asked 21/1, 2019 at 4:26
2
Solved
i was trying to migrate react-redux v5.X.X to v6.0.0 and there dosent seem to be any documentation for it.
i am using following versions :
"react": "^16.4.2"
"redux": "^4.0.0"
"react-redux": "^6....
Ruble asked 11/12, 2018 at 20:9
3
Solved
I am using [email protected] and [email protected] that should support react Context and trying to run a simple example same as the react-context:
app.js
import React, { Component } fro...
Retail asked 25/12, 2018 at 16:56
5
Solved
React 16.3.0 was released and the Context API is not an experimental feature anymore. Dan Abramov (the creator of Redux) wrote a good comment here about this, but it was 2 years when Context ...
Scission asked 30/3, 2018 at 3:42
0
I am having a hard time setting a ref within a context provider. Is this not possible or is there something I am missing? I am able to createRefs in other components the same way but the following ...
Disrate asked 8/11, 2018 at 19:18
1
Solved
I'm trying out the new context API using a HOC that returns a wrapped component. It doesn't work when I use the Class.contextType = Context approach:
return function myHOC(WrappedComponent) {
cla...
Cordillera asked 1/11, 2018 at 22:13
2
Solved
So, I have two components, one is always going to be a direct descendant of another. I want to pass props from parent component to the child. There could be more than one child components. There're...
Overhear asked 28/9, 2018 at 9:52
2
I have an app using Redux. Is stores the global state as shown below:
Create Store:
import {createStore, applyMiddleware} from 'redux';
import rootReducer from '../reducers';
import thunk from 'r...
Continuity asked 3/8, 2018 at 12:15
1
Solved
I'm new to React Router and trying to do a redirect from inside a provider using the new Conext API. basically my provider looks like this.
/* AuthContext.js */
class AuthProvider extends React.C...
Eleventh asked 23/7, 2018 at 11:40
2
The following applies to SSR via NextJS.
I'm using React's context to keep track of IDs of certain mounted components. The gist is
class Root extends React.Component {
getChildContext () {
ret...
Millstream asked 11/6, 2018 at 19:32
1
Solved
Consider the following scenario:
import React, { Component } from 'react';
import LocaleService from '../Services/LocaleService.js';
const defaultStore = {
loaded: false,
locales: []
};
const ...
Okeefe asked 18/5, 2018 at 11:41
2
Solved
Edit: Answer Below
I've followed both of these tutorials on youtube (currently there aren't too many) but none of them work for me, it sends me this error from the Provider in the index.js:
Tutor...
Sorrows asked 7/4, 2018 at 2:51
2
Solved
I'm trying to use the new React context to hold data about the logged-in user.
To do that, I create a context in a file called LoggedUserContext.js:
import React from 'react';
export const Log...
Conceive asked 3/4, 2018 at 12:19
© 2022 - 2024 — McMap. All rights reserved.