Questions tagged [unstated]
22 questions
6
votes
2 answers
How to use react unstated outside of render method?
I am using ustated library in my project.
In render method, I am using set like this:
render() {
return (
{api => (

gaijebou
- 71
- 5
3
votes
2 answers
Unstated store based React Navigation causing warning
I'm using react-navigation and Unstated in my react native project.
I have a situation where I would like use:
this.props.navigation.navigate("App")
after successfully signing in.
Problem is I don't want it done directly from a function assigned to…

Adrian Bartholomew
- 2,506
- 6
- 29
- 37
3
votes
2 answers
React - Can you update an Unstated container state from an external function?
In the example from the Unstated library they update state within a container by interacting with a jsx button that is subscribed to the container.
import React from 'react';
import { render } from 'react-dom';
import { Provider, Subscribe,…

Shawn Matthews
- 1,762
- 1
- 15
- 21
2
votes
2 answers
Avoiding store reinitialization with unstated
I am trying out unstated (https://github.com/jamiebuilds/unstated) and like its simplicity but am experiencing unexpected behavior. At the top level I have:
{myDataStore => (
…

ed94133
- 1,477
- 2
- 19
- 40
1
vote
1 answer
How can I access a state of another file (and function) in React JS?
I'm looking for a solution for my problem. I'm using a library called unstated (https://github.com/GitbookIO/unstated). It makes a global state for an reactjs app. The problem is: I can't use a state made on a function X in my function Y. In this…

Paulo Henrique
- 25
- 1
- 6
1
vote
2 answers
Way to inject custom props/methods to `handleSubmit`?
I'm using react hook form, and I'm looking for a way to inject custom props to the handleSubmit method returned by the hook. The reason I need to do this is my component acts as a Consumer for a state library, and I want to update the state after…

Jay K.
- 546
- 2
- 10
- 17
1
vote
1 answer
Destructuring with unstated.js
I have this Unstated container:
import { Container } from 'unstated';
import axios from 'axios';
export default class CurrenciesContainer extends Container {
state = { currencies: null };
async fetch() {
const { data: currencies } = await…

Matt Fletcher
- 8,182
- 8
- 41
- 60
1
vote
1 answer
Undefined Unstated Container in a React Native Component using React Navigation
My problem is That I want to access a Container in a component but it seems to be undefined.
undefined alert image
I am using Unstated and as you can see this is my code in the container file (login-container.js):
import { Container } from…

M.Mahdi Nabiollahi
- 21
- 8
1
vote
1 answer
Using Unstated with TypeScript and React, how to get a typed container instance inside children?
In my React app, I'm using Unstated to manage shared state, but I'm running into a problem using this with TypeScript: the component passes me an instance of my state that's typed as Container. This means it will need to be cast to…

Justin Grant
- 44,807
- 15
- 124
- 208
1
vote
2 answers
Initializing the Container with API call unstated.js (React Context API)
I would like to simply initialize the Container state with data from an api call using unstated.js (a React Context wrapper).
I saw one example where the Container was instantiated with a couple vars:
import { Container} from 'unstated';
class…

Ryan
- 449
- 5
- 21
1
vote
1 answer
Unstated.js accessing container within other container
I've just started looking into unstated and I've bumped into an issue for which I can't find an answer yet.
Suppose I have two containers:
ContainerA
ContainerB
What should I do if I wanted to either access ContainerB state in ContainerA or even…

Vytautas Butkus
- 5,365
- 6
- 30
- 45
0
votes
1 answer
Does React update the parent contexts when a child context is updated?
I am using unstated-next for state management. And for my application I am having multiple containers. Which created multiple React Contexts. And the providers are nested one under the other.
You can assume like layers. Let layer 3 be the outermost…

Shanmu
- 3
- 3
0
votes
0 answers
setState action wit setTimeout brings back removed elements
I'm trying to make toast notifications in my project by myself and I'm almost there but I have a little problem now. I set up my notifications and made it disappear on click. But then I added setTimeout to remove toast from my state after 5 seconds…

Dawid Szemborowski
- 93
- 1
- 9
0
votes
1 answer
using 'Unstated' with React Js for fetching data from API endpoint
I have already developed an app to fetch weather data from openweathermap.org. The app is built using redux and redux-saga.
Now I have to redo it using "Unstated" instead of Redux for the state management.
The WeatherContainer.js class handles the…

rathindu_w
- 611
- 1
- 5
- 12
0
votes
1 answer
Calling unstated function using componentDidMount or from another file
I am trying to create a context to store all the info needed for my app, the code below works but I do have limitations, this is Api.js where I want to put all the logic and API requests/responses.
import { Provider, Subscribe, Container } from…
user7319004