Код: Выделить всё
import React, { useState } from "react";
function ExampleReactComponent() {
const [clickCount, setClickCount] = useState(0);
return (
className="example-react-component"
onClick={() => setClickCount((prev) => prev + 1)}
>
Hello World!
You have clicked on this component {clickCount} times!.
);
}
export default ExampleReactComponent;
< /code>
Вот мой пакет. Json как текст < /p>
{
"name": "brads-boilerplate-theme",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"preview": "npm-run-all --parallel sync start",
"sync": "browser-sync start -p 'nr4test.local' --files '**/*.php' 'build/*.js' 'build/*.css'",
"build": "wp-scripts build",
"start": "wp-scripts start",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@wordpress/scripts": "^27.9.0",
"browser-sync": "^3.0.2",
"npm-run-all": "^4.1.5"
}
}
Последствия запуска NPM запуска и работают так же, как видеоурок:
Подробнее здесь: https://stackoverflow.com/questions/795 ... ound-error