Search
 
SCRIPT & CODE EXAMPLE
 

CSS

react wrapper component

flexWrap: 'wrap'
Comment

react web component wrapper

import React, { createElement, useRef, useLayoutEffect, memo } from 'react';

const _WcWrapper = (props) => {
  const { wcTag, children, ...restProps } = props;
  const wcRef = useRef(null);

  useLayoutEffect(() => {
    const wc = wcRef.current;

    for (const [key, value] of Object.entries(restProps)) {
      if (key in wc) {
        if (wc[key] !== value) {
          wc[key] = value;
        }
      } else {
        if (wc.getAttribute(key) !== value) {
          wc.setAttribute(key, value);
        }
      }
    }
  });

  return createElement(wcTag, { ref: wcRef });
};

export const WcWrapper = memo(_WcWrapper);
Comment

PREVIOUS NEXT
Code Example
Css :: span size css 
Css :: showing two iframes side by side 
Css :: box shadow example 
Css :: difference between inline block and inline-block 
Css :: scrollbar with 2 different colors on same page css 
Css :: border css 
Css :: how to comment in css 
Css :: para que sirve justify-content-center 
Css :: npm next-css 
Css :: changong text color css 
Css :: css offset border 
Css :: button active css 
Css :: registration form in tailwind css 
Css :: circle percentage css 
Css :: css keep aspect ratio image 
Css :: Scrollbar inside a website 
Css :: javascript index value 
Css :: stop mysqld.exe cmd 
Css :: css font-family 
Css :: preserve aspect ratio image css 
Css :: andy bells css reset 
Css :: blue gradient 
Css :: align svg and text inside button 
Css :: text overlay animation css 
Css :: Latest compiled and minified CSS 
Css :: how to see applications installed by wine cmd 
Css :: border animation css codepen 
Css :: input disabled css 
Css :: css background templates 
Css :: css custom easing 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =