Hey guys I'm trying to remove the border of the last item in an unordered list when the list grows to a certain size. My initial thought was something like:
document.querySelector('.employee-list-item:last-child').style.border = "none";
However, React says it can't set the style property on 'null.' Is it trying to target the element before it's been rendered? Any workarounds for this?
Here's my code:
import "../css/Employee.css";
import Avatar from "./Avatar";
import React from "react";
const Employee = (props) => {
// capitalize first letter of firstName and first letter of lastName
const name = props.name
.split(" ")
.map((i) => i[0].toUpperCase() + i.slice(1))
.join(" ");
const { title } = props;
return (
<li className="employee-list-item">
<Avatar name={props.name} />
<span className={"employee-name"}>{name}</span>
<span className={"employee-title"}>{title}</span>
</li>
);
};
export default Employee;