Possible to dispatch an action without connect?

You can directly dispatch using the store object.

store.dispatch({type:"UPDATE_VARIABLE", payload:variable.value})

If you are in some other component where the store object isnt readily available, export it from the main component and import it to a location where it is needed and use the above statement


react-redux has own hooks to call them

const dispatch = useDispatch();
const state = useSelector((state) => state);

do not forget to import them

import { useDispatch, useSelector } from 'react-redux';

vs code will autocomplete if you write useDispatch


You can use this code and add the constructor in the class like this

  constructor(props) {
    super(props);
  }

  onLocation() {
    this.props.dispatch({type: GET_THINGS_REQUESTED, payload: value});
  }