score:1

if you need to send some route state then the push method takes an object.

const getprofile = (member) => {
  console.log(member)
  props.history.push({
    pathname: '/member',
    state: {
      user: member,
    },
  });
  console.log('----------- member------------')
}

additionally, member is a functional component, so there is no this, just use the props object.

the route state is on the location prop, not the history object.

const member = (props)=> {  
  const [user, setuser] = usestate({});
  const { state } = props.location;

  // access state.user

also additionally, useeffect callbacks can't be async as these imperatively return a promise, interpreted as an effect cleanup function. you should declare an internal async function to invoke. on top of this, the setuser function isn't async so it can't be awaited on.

the following is what i think should be the effects for populating the user state and issuing side-effects:

// update user state when route state updates
useeffect(() => {
  if (state && state.user) {
    setuser(state.user);
  }
}, [state]);

// run effect when user state updates
useeffect(() => {
  const doeffects = async () => {
    try {
      const p = await incidentsinstance.usersprofile(state.user, { from: accounts[0] });
      const a = await sninstance.getusersposts(state.user, { from: accounts[0] });
    } catch (e) {
      console.error(e)
    }
  }

  doeffects();
}, [user]);

Related Query

More Query from same tag