how to redirect in ionic react
import React, {Component, useCallback, useContext} from 'react';
import {NavContext} from '@ionic/react';
// Functional component example
function MyComponent() {
  const {navigate} = useContext(NavContext);
  // Call this function when required to redirect with the back animation
  const redirect = useCallback(
    () => navigate('/new/address', 'back'),
    [navigate]
  );
}
// Class component example
class MyComponent extends Component {
  static contextType = NavContext;
  // Call this method when required to redirect with the back animation
  redirect() {
    this.context.navigate('/new/address', 'back');
  }
}
