score:0
you should add the state that named 'resume' to the useeffect. that means second useeffect would run after every setresume call
const { authuser } = useselector((state) => state.auth);
const [resume, setresume] = usestate({});
const [experience, setexperience] = usestate([]);
let resumeservice = new resumeservice();
let resumeexperienceservice = new resumeexperienceservice();
useeffect(() => {
resumeservice
.getresumebycandidateid(authuser.id)
.then((result) => setresume(result.data.data[0]));
}, []);
useeffect(() => {
resumeexperienceservice
.getexperiencesbyresumeid(resume.id)
.then((result) => setexperience(result.data.data));
}, [resume]);
Source: stackoverflow.com
Related Query
- Is it possible to put in order React useEffects?
- Is it possible to put a callback to useReducer's dispatch in React Hooks?
- Is it possible to use React Hooks in class component by using HOC(Higher Order Component)?
- Is it possible to implement an inheritance like mechanism for React components in order to reduce nearly duplicate code?
- Is it possible to apply a React Higher Order Component to a general div?
- Is it possible to return empty in react render function?
- Is it possible to use if...else... statement in React render function?
- Does React keep the order for state updates?
- Is it possible to use dotenv in a react project?
- Put length constraint in a TextField in react js
- Is it possible to use React without rendering HTML?
- Is it possible to set a className on custom react components?
- React Material UI - Export multiple higher order components
- Why do people put { " " } in their React / JSX?
- Is it possible to pass a React Component as argument in between functions of a Container Component
- Is it OK to put propTypes and defaultProps as static props inside React class?
- Is it possible to use async / await in React JS?
- What's useEffect execution order and its internal clean-up logic in react hooks?
- Is it possible to use react-datepicker with react hooks forms?
- Is it possible to use Material UI library with React Native?
- Where do I put coding logic in my React Application
- React.js: Is it possible to convert a react component to HTML DOM's?
- Where should I put images files in React project?
- What is the correct order of execution of useEffect in React parent and child components?
- Can I put ajax in React component constructor?
- Is it possible to run React project without npm start?
- Is it possible to define a ReactJS Mixin method that can be overridden in a React Component?
- Canceling an Axios REST call in React Hooks useEffects cleanup failing
- Order of Provider and Router in React app
- Is it possible to hide the "BugReporting extraData" in React Native? (Using Expo)
More Query from same tag
- How can I access the ref of the BaseComponent or any level of the components?
- React - one event handler to toggle one of multiple similar elements
- Display custom third party html element inside a React component
- How can we draw a flowchart diagram in an react application?
- Global SASS variables in reactjs app
- React doesn't render array value from firebase and array's length is 0 despite having the value on console
- Antd select element: how can I disable typing?
- React fixed data table make responsive
- How to Pass a method as props for an element in react
- React Bootstrap - Adding logic to a button
- Trying to build a basic React-Redux click switcher but nothing is displayed
- Styled-component and Material component (Media queries)
- radio button "checked" disappearing after click to another radio button
- How to works setState function?
- How to optimize React components with React.memo and useCallback when callbacks are changing state in the parent
- React and NodeJS upload file with Multer can`t set filename and termination
- How to trigger anchor tag :target action even at same position?
- “React” undefined for React Router with Typescript
- Replace all strings and wrap as html
- How to use onChange method in semantic react dropdown
- Mock external library call using jest
- Cannot Read image of undefined in React app
- Inject CSS Modules to Per-Component Style Elements (for portability to shadow root)
- Calculate percentage difference live websocket
- AMD w/ define() doesn't work in a particular case (create-react-app based app; webpack; babel)
- NextJS project: immediately send user to Auth0 page
- Can you add a key to a React JSX Element after it's instantiated?
- How to bind onclick handlers to `this` properly on React
- How to add a checbox at the starting of every row in react-virtualized table?
- Change class name of list element based on incremental props value - ReactJS