fk-react-ui-components
Version:
Step 1 : Create a file in [ Seeds / Plants / Trees ] <br> Step 2 : It should export an Object with component name and story Component [Refer other components] <br> Step 3 : Story Component should return a react component <br> Step 3 : Created file should
15 lines (14 loc) • 508 B
JavaScript
import React from "react";
import {NameExceptionHandler} from "./NameException.js";
import Error from "../../FormElements/Error/Error.js"
/* "this" context refers to FormComponent instance */
export function ErrorInstanceHandler(o){
if(o.type == Error){
NameExceptionHandler(o.props.name);
let errorState = `${o.props.name}_error`;
o = React.cloneElement(o, {
error : this.state["error"][errorState]?this.state["error"][errorState]:""
})
}
return o;
}