Answer the question
In order to leave comments, you need to log in
How to pass a component to render as props?
Good afternoon, there is a "Link" component, you need to add it, it is possible to pass a component to the props that will render the link.
There are no problems with this, the problem is with the "standard" component for rendering,
here is the component code:<a />
function Link = (props) => {
const Component = props.component || <a/>; // тут проблема
return (<Component
{...props}
/>);
};
const Component = props.component || (props) => <a {...props} />;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question