Hey guys, doing a take-home for a job prospect and I am making essentially a redux todo app. My adding functionality doesn’t work, what am I doing wrong?
The component:
import React, { useState, useEffect } from 'react'
import { connect } from 'react-redux'
import { addEmployee } from '../../redux/actions'
import { v4 as uuid } from 'uuid';
import {
Backdrop,
Modal,
Fade,
TextField,
FormControlLabel,
Switch
} from '@material-ui/core'
// Styles
import { makeStyles } from '@material-ui/core/styles'
const useStyles = makeStyles(() => ({
modal: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
This file has been truncated. show original
The reducer:
import { ADD_EMPLOYEE, EDIT_EMPLOYEE } from '../actionTypes'
const initialState = {
employees: [
{
id: 0,
firstName: 'Russ',
middleInitial: 'M',
lastName: 'Storms',
dateOfBirth: 'October 3, 1990',
dateOfEmployment: 'March 25, 2020',
isActive: true,
},
{
id: 1,
firstName: 'Russ',
middleInitial: 'M',
lastName: 'Storms',
dateOfBirth: 'October 3, 1990',
dateOfEmployment: 'March 25, 2020',
This file has been truncated. show original
Didn’t you just forget to pass in {addEmployee}
to the AddEmployee
component?
Oh my god, as a prop, I am so stupid, thank you so much.
1 Like
No, you are not stupid. There is a lot to keep track of and it isn’t easy to do as a one-man job.
Are you using the Redux dev tools?