UNPKG

@lemonadejs/calendar

Version:

LemonadeJS reactive JavaScript calendar plugin

42 lines (36 loc) 1.19 kB
// @ts-nocheck import React, { useRef, useEffect } from "react"; import Component from './index'; // @ts-ignore export default React.forwardRef((props, mainReference) => { // Dom element const Ref = useRef(null); // Get the properties for the spreadsheet let options = { ...props }; useEffect(() => { // @ts-ignore if (Ref.current.innerHTML) { for (let key in props) { if (key === 'onchange' || key === 'onload') { continue; } if (props.hasOwnProperty(key) && mainReference.current.hasOwnProperty(key)) { if (props[key] !== mainReference.current[key]) { mainReference.current[key] = props[key]; } } } } }, [props]) useEffect(() => { // @ts-ignore if (! Ref.current.innerHTML) { mainReference.current = Component(Ref.current, options); } }, []); let prop = { ref: Ref, style: { height: '100%', width: '100%' } }; return React.createElement("div", prop); })