Category : react-functional-component

I need to entertain user a bit while he’s waiting the pages reloading/routing from one page to another. My app is using ReactRouter and (obviously) React. How to set such a page that will be a placeholder while the target page is reloading. Say, rotating logo or something like that! Is it possible to do ..

Read more

TLDR; In trying to remount a child component, I can do this: const {index} = useParams(); const [state, setState] = useState(index); useEffect(() => { setState(index) }, [index]); return <SomeComponentINeedToReMount key={state} />; But not this: const {index} = useParams(); return <SomeComponentINeedToReMount key={index} />; Why? Long version: SomeComponentINeedToReMount has its own (somewhat complex) state, using useReducer. The ..

Read more

So I am trying to update state in the parent component from the child component (child component calls axios) and then I want to send this state from parent component to another child component via route but the state is not getting updated, maybe because I am sending state initailly in the route, can anyone ..

Read more

The code below is just an example I found online. import { observable, computed } from "mobx"; import { observer } from "mobx-react"; import React from "react"; import { SafeAreaView, Text, TextInput, StyleSheet } from "react-native"; @observer class Shop extends React.Component { @observable price = 9; @observable quantity = 11; @computed get total() { return ..

Read more