lebel-studio / web /libs /editor /src /Component.jsx
bisalsaha's picture
Upload 8831 files
a7060a0 verified
Raw History Blame Contribute Delete
714 Bytes
import { Component } from "react";
import App from "./components/App/App";
import { configureStore } from "./configureStore";
export class LabelStudio extends Component {
state = {
initialized: false,
};
componentDidMount() {
configureStore(this.props).then(({ store }) => {
this.store = store;
window.Htx = this.store;
this.setState({ initialized: true });
});
}
componentDidUpdate(prevProps) {
if (this.props.task !== prevProps.task) {
this.store.resetState();
this.store.assignTask(this.props.task);
this.store.initializeStore(this.props.task);
}
}
render() {
return this.state.initialized ? <App store={this.store} /> : null;
}
}