gorules / jdm-editor

JDM Editor is an open-source React component for crafting and designing JDM (JSON Decision model) files.
https://gorules.io
MIT License
123 stars 36 forks source link

Issue using jdm-editor react component in another project #36

Closed bala-pitchuka closed 4 months ago

bala-pitchuka commented 5 months ago

please find the snippet

import { DecisionGraph, JdmConfigProvider } from '@gorules/jdm-editor'; import '@gorules/jdm-editor/dist/style.css';

function App() {
  return (
    <div className="App">
      <JdmConfigProvider>
        <DecisionGraph
          onChange={(val) => setGraph(val)}
        />
      </JdmConfigProvider>

    </div>
  );
}

export default App;

Error

Failed to compile.

[eslint] src/App.js Line 11:30: 'setGraph' is not defined no-undef

Search for the keywords to learn more about each error. ERROR in [eslint] src/App.js Line 11:30: 'setGraph' is not defined no-undef

Search for the keywords to learn more about each error.

webpack compiled with 1 error

ivanmiletic commented 5 months ago

Hi, this looks like and issue on your side with linter when using components - you will need to set a state you are missing const [graph, setGraph] = useState()