Unable to add onclick to svg path in React functional component
问题 import React, { useEffect, useState } from "react"; import SVG from "react-inlinesvg"; import axios from "axios"; export default function App() { const [color, setColor] = useState("red"); const [image, setimage] = useState(null); const fill = () => { setColor("green"); }; useEffect(() => { axios .get("https://file.qwertygo.com/media/image/cyan_qWYARBm.svg") .then(({ data }) => { setimage( [ data.substring(0, data.search("currentcolor") + 13), ` onClick={fill()} `, data.substring(data.search(