`
import React from "react";
function Alert(props) {
const capitalize = (word) => {
const lower = word.toLowerCase();
let msg = lower.charAt(0).toUppererCase() + lower.slice(1);
return msg;
};
return (
props.alert && (
<div className={`alert alert-${props.alert.type} alert-dismissible fade show`}
role="alert">
<strong>{capitalize(props.alert.type)}</strong> : {props.alert.msg}
</div>
));
}
export default Alert;
`
I was trying to capitalize the first letter of my props.alert.type. but the console throws an err!! before writing the capitalize function the code was running just fine!! the type is a string "success", had to capitalize "s" but now I have this error before capitalize function I was getting that alert message as I intended. console err msg