Error "Unexpected character '�'. (1:0)" when creact a higher order component in react

Viewed 20

I'm beginner in react.js.
I'm tring to create my own higher order component.
But I have a problem. enter image description here

my code: withState.jsx:

import React from "react";

export function withState(component) {
    const C = component;

    return function (props) {
        return <C {...props} extraProp="withState() is runing..." />;
    };
}

Component file (Header.jsx):

import React from "react";
import { withState } from "./../HOFs/withState";

function Header(props) {
    return (
        <>
            <h2>Header</h2>
            <p>{JSON.stringify(props)}</p>
        </>
    );
}

export default withState(Header);
0 Answers
Related