I'm having a "no-undef" issue in my ReactJs app, the console says:
- Uncaught ReferenceError: equipment is not defined at Equipment line 18 and line 21.
- Uncaught ReferenceError: identifier is not defined at Object../src/reducers/equipment.js (equipment.js:5)
This is the code I've written:
Component (..components/Equipment.js):
import React, { Component } from 'react';
import {connect} from 'react-redux';
class Equipment extends Component {
render() {
return (
<div>
{this.props.equipment.map(note => (
<div className="card">
<div className="card-header">
Equipment
</div>
<div className="card-content">
<table>
<tbody>
<tr>
<td>{equipment.identifier}</td>
</tr>
<tr>
<td>{equipment.location}</td>
</tr>
</tbody>
</table>
<button>edit</button><button>delete</button>
</div>
</div>
))}
</div>
)
}
}
const mapStateToProps = state => {
return {
equipment: state.equipment,
}
}
const mapDispatchToProps = dispatch => {
return {
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Equipment);
Reducer (..reducers/equipment.js):
const initialState = [
{
equipment: [
identifier: "My Machine 1",
location: "My Location 1"
]
}
];
export default function equipment(state=initialState, action) {
switch (action.type) {
default:
return state;
}
}
Any idea of where's the error exactly? Thank you.