I am new to React and I have a simple child-component. I want to set default props so if no prop is given when the component is called it uses whatever the defaults are set at. So far I have:
import React from 'react';
interface titleComponentProps {
title?: string;
}
const titleComponentDefaults = ({
title: "default title",
})
const titleComponent = ({
title,
}: titleComponentProps) => {
return <React.Fragment>{title}</React.Fragment>;
};
export default DynamicHelperText;
I am unclear as to how to have the default props appear in the component. Would anyone know the best way to do this?