import React from 'react';
import Input from 'components/input';
import Button from 'components/button';

export default function() {
    const ref: any = React.createRef();
    return (
        <div>
            <Input validator={(e: string) => e.length >= 4 || '长度小于4'} ref={ref} />
            <Button
                onClick={() => alert(`当前状态：${ref.current.isValid ? '正常' : '有错误'}`)}
                style={{ marginLeft: 20 }}
            >
                check
            </Button>
        </div>
    );
}
