
13

React/Govern - CodeSandbox
source link: https://codesandbox.io/s/0y10o4977l
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

React/Govern - CodeSandbox
File
Edit
Selection
View
Go
Help
Sandbox Info
React/Govern
A basic React/Govern projectreact
govern
Files
public
index.js
package.json
External resources
Sign in to
✓Save your work✓Work from any device✓Deploy & collaborate
import * as Govern from "govern";
import * as React from "react";
import * as ReactDOM from "react-dom";
import { Subscribe } from "react-govern";
class FieldModel extends Govern.Component {
static defaultProps = {
defaultValue: ""
constructor(props) {
super(props);
this.state = {
value: props.defaultValue
render() {
let value = this.state.value;
let error = this.props.validate ? this.props.validate(value) : null;
return {
value: this.state.value,
error: error,
Browser
Tests
Console
Problems
React DevTools
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK