Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props) {
super(props);
this.state = { Employees: [], newName: '' };
// Connect this component to the back-end view model.
this.vm = dotnetify.react.connect('SimpleListVM', this);
// Set up function to dispatch state to the back-end.
this.dispatch = state => this.vm.$dispatch(state);
this.dispatchState = state => {
this.setState(state);
this.vm.$dispatch(state);
};
}
constructor(props) {
super(props);
this.state = { FirstName: '', LastName: '' };
// Connect this component to the back-end view model.
this.vm = dotnetify.react.connect('HelloWorldVM', this);
// Set up function to dispatch state to the back-end.
this.dispatchState = state => this.vm.$dispatch(state);
}
removeOrphan(vmId) {
// Clear any existing connection to the same view model.
dotnetify.react.getViewModels().filter(vm => vm.$vmId === vmId).forEach(vm => vm.$destroy());
}
}
constructor() {
super();
this.state = { ListItems: [], selected: 0 };
this.vm = dotnetify.react.connect('MasterDetails.MasterList', this);
}
constructor(props) {
super(props);
this.state = {};
if (this.props.accessToken) {
let authHeader = { Authorization: 'Bearer ' + this.props.accessToken };
this.vm = dotnetify.react.connect('AdminSecurePageVM', this, { headers: authHeader, exceptionHandler: ex => {} });
}
}
constructor(props) {
super(props);
this.state = { Greetings: '', ServerTime: '' };
dotnetify.react.connect('HelloWorld', this);
}
connect(vmId, options, onStateChange) {
vmId = this.host.vmContext ? `${this.host.vmContext.vmId}.${vmId}` : vmId;
if (!vmId) throw new Error("'vmId' is required by connect()");
this.removeOrphan(vmId);
this.vm = dotnetify.react.connect(vmId, this.host, {
setState: state => {
this.setState(state);
this.notifyStateChange(state, onStateChange);
},
...options
});
this.vmId = vmId;
return this.vm;
}
render() {
const { framework } = this.state;
const example = framework === 'Knockout' ? this.props.ko : framework === 'Vue' ? this.props.vue : this.props.react;
if (!example) dotnetify.react.router.pushState({}, null, '/core/overview');
return (
{example}
);
}
}
componentDidUpdate() {
if (this.state.framework === 'Knockout') dotnetify.react.router.pushState({}, null, '/core/overview');
}
render() {
constructor(props) {
super(props);
dotnetify.offline = true;
this.vm = dotnetify.react.connect(this.props.viewModel, this);
}
componentWillUnmount = () => this.vm.$destroy();