Q:

Unable to connect component to Redux store

I'm trying to connect my component CMSForm to the Redux store but have not been able to do so.  Here is my:
Reducer:
const cmsDefaultState = {
  cmsNum: "",
  facilityName: ""
};

export default (state = cmsDefaultState, action) => {

  switch (action.type){

    case 'SET_CMS_ID':
      return Object.assign({}, state, {
        cmsNum: action.cmsNum
      });

    case 'SET_FACILITY_NAME':
      return [
             ...state,
              action.facilityName
          ];

    default:
      return state;
  }

};

Store:
import { createStore} from 'redux'
import CMSReducer from './CMSReducer.js'

export default () => {
  const store = createStore(CMSReducer);
  return store;
};

Selectors:
export const getCMSNum = store =>
  store.cmsNum

export const getFacilityName = store =>
  store.facilityName

Methods:
export const setCMSId = (cmsNum = '') => ({
  type: 'SET_CMS_ID',
  cmsNum
});

export const setFacilityName = (facilityName = '') => ({
  type: 'SET_FACILITY_NAME',
  facilityName
});

This is the component:
import React from 'react'
import { connect } from 'react-redux';
import { setCMSId } from '../redux/methods'
import { getCMSNum } from "../redux/selectors";

function mapStateToProps(state) {
  const { CMSReducer } = state
  return { CMSForm: CMSReducer }
}

class CMSForm extends React. Component {

  constructor(props) {
    super(props);

    this.state = {
      cmsCertificationNumber: '',
      facility_name: ''
    };

    this.handleChange = this.handleChange.bind(this);
    this.handleCmsNumber = this.handleCmsNumber.bind(this);
  }

  handleCmsNumber = () => {
    // dispatches actions to add todo
    debugger
    setCMSId(this.state.cmsCertificationNumber);
    alert("CMS Number: " + this.state.cmsNum);

  } // end of HandleCMSNumebr

  handleChange(event) {
   this.setState({cmsCertificationNumber: event.target.value});
 }

  render() {
    return (
      <div>

        <input type="text" value={this.state.cmsCertificationNumber} onChange={this.handleChange} />

        <button className="update-cmsNum" onClick={this.handleCmsNumber}>
          Find
        </button>
      </div>
    )
  }
} // end of component

export default connect(state => ({ cmsNum: getCMSNum(state) }))(CMSForm);

If you see in this small snippet of code, I'm trying to set the CMS ID. 
setCMSId(this.state.cmsCertificationNumber);
    alert("CMS Number: " + this.state.cmsNum);

And if anyone wants to see my index.js, here it is:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

import { Provider, connect } from 'react-redux';
import configureStore from './redux/configureStore.js'

import { setCMSId } from './redux/methods.js'
const store = configureStore();

// store.dispatch(setCMSId("Hello"));
// console.log("[" + store.getState().cmsNum + "]");

ReactDOM.render(
  <React. StrictMode>
  <Provider store={store}>
      <App />
    </Provider>
  </React. StrictMode>,
  document.getElementById('root')
);

serviceWorker.unregister();

But this doesn't seem to trigger the store either.  I'm not sure what I'm doing wrong?  The CMSForm component is inside my App.js, where I don't have any mention of the Redux store.  I only have it inside my index.js So not sure where I'm going wrong or what to do. 
Any help would be appreciated, thank you! 

A:

Things you need to correct:

Here you're returning an array but your state is an object. 
case 'SET_FACILITY_NAME':
   return [
          ...state,
           action.facilityName
       ];

If you take a look at this line of code:
setCMSId(this.state.cmsCertificationNumber)
you're just calling the function that returns an object.   You should dispatch the action. 

You have an unused function
function mapStateToProps(state) {
 const { CMSReducer } = state
 return { CMSForm: CMSReducer }
}

You're not using the state that is mapped to the props here:
export default connect(state => ({ cmsNum: getCMSNum(state) }))(CMSForm);

Update
You can use dispatch in this way:
import React from 'react'
import { connect } from 'react-redux';
import { setCMSId } from '../redux/methods'
import { getCMSNum } from "../redux/selectors";

class CMSForm extends React. Component {

    constructor(props) {
        super(props);

        this.state = {
            cmsCertificationNumber: '',
            facility_name: ''
        };
    }

    handleCmsNumber = () => {
        // to dispatch the `setCMSId` action. 
        this.props.setCMSId(this.state.cmsCertificationNumber);

    } // end of HandleCMSNumebr

    handleChange = (event) => {
        this.setState({ cmsCertificationNumber: event.target.value });
    }

    render() {
        console.log(this.props.cmsNum);
        return (
            <div>

                <input type="text" value={this.state.cmsCertificationNumber} onChange={this.handleChange} />

                <button className="update-cmsNum" onClick={this.handleCmsNumber}>
                    Find
        </button>
            </div>
        )
    }
} // end of component

const mapStateToProps = state => ({ cmsNum: getCMSNum(state) });
const mapDispatchToProps = {setCMSId};

export default connect(mapStateToProps, mapDispatchToProps)(CMSForm);

