You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useEffect(() => {
// Only initialize scratch-gui if it's available
if (scratchGUI) {
const { AppStateHOC, default: GUI } = scratchGUI;
if (AppStateHOC && GUI) {
const Wrapped = AppStateHOC(GUI); // Wrap the GUI with AppStateHOC
setWrappedGUI(() => Wrapped); // Set the wrapped GUI component
}
}
}, []);
// If the GUI is not loaded yet, show a loading message
if (!WrappedGUI) {
return
Loading...
;
}
const locale = useSelector((state) => state.locales.locale || "en"); // Get locale from Redux state
const messages = useSelector((state) => state.locales.messages || {}); // Get messages from Redux state
fetch-worker.7a0adc94df277ffeb963.js:1 Uncaught SyntaxError: Unexpected token '<' (at fetch-worker.7a0adc94df277ffeb963.js:1:1)
My scratchEditor file looks like this:
`
import React, { useEffect, useState } from "react";
import { Provider, useSelector } from "react-redux";
import { IntlProvider } from "react-intl";
import { store, scratchGUI } from "../stores/store"; // Import store and scratchGUI
const ScratchApp = () => {
const [WrappedGUI, setWrappedGUI] = useState(null);
useEffect(() => {
// Only initialize scratch-gui if it's available
if (scratchGUI) {
const { AppStateHOC, default: GUI } = scratchGUI;
}, []);
// If the GUI is not loaded yet, show a loading message
if (!WrappedGUI) {
return
}
const locale = useSelector((state) => state.locales.locale || "en"); // Get locale from Redux state
const messages = useSelector((state) => state.locales.messages || {}); // Get messages from Redux state
return (
{" "}
{/* Provide the Redux store to the app /}
<div style={{ width: "100vw", height: "100vh" }}>
{/ Render the wrapped Scratch GUI */}
);
};
export default ScratchApp;
`
The text was updated successfully, but these errors were encountered: