import { jsx, jsxs, Fragment } from 'solid-jsx/jsx-runtime';

/*@jsxRuntime automatic @jsxImportSource solid-jsx*/
const toc = [];
function _createMdxContent(props) {
  const _components = Object.assign({
    p: "p",
    code: "code",
    pre: "pre",
    span: "span"
  }, props.components);
  return jsxs(Fragment, {
    children: [jsxs(_components.p, {
      children: ["On many occassions, you might want to expose a ref from inside a component to a parent. The way we do this is still by using the ", jsx(_components.code, {
        children: "ref"
      }), " attribute. From the outside, using ", jsx(_components.code, {
        children: "ref"
      }), " on a component works very similar to using ", jsx(_components.code, {
        children: "ref"
      }), " on a native element. You can pass it a variable to be assigned or a callback function."]
    }), "\n", jsxs(_components.p, {
      children: ["However, it is the component author's responsibility to connect that ", jsx(_components.code, {
        children: "ref"
      }), " to an internal element to forward it back up. To do so, we leverage ", jsx(_components.code, {
        children: "props.ref"
      }), ". This is a callback form of ", jsx(_components.code, {
        children: "ref"
      }), " if either type of ", jsx(_components.code, {
        children: "ref"
      }), " is given, but this detail is mostly hidden from you as you will more than likely just be assigning it directly to the ", jsx(_components.code, {
        children: "ref"
      }), " attribute of one of the elements or components in this component's JSX."]
    }), "\n", jsxs(_components.p, {
      children: ["To get the logo animating again, we need to forward the ref from ", jsx(_components.code, {
        children: "canvas.jsx"
      }), ":"]
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: ["<canvas ref={props.", jsx(_components.span, {
          className: "hljs-property",
          children: "ref"
        }), "} width=", jsx(_components.span, {
          className: "hljs-string",
          children: "\"256\""
        }), " height=", jsx(_components.span, {
          className: "hljs-string",
          children: "\"256\""
        }), " />\n"]
      })
    })]
  });
}
function MDXContent(props = {}) {
  const {wrapper: MDXLayout} = props.components || ({});
  return MDXLayout ? jsx(MDXLayout, Object.assign({}, props, {
    children: jsx(_createMdxContent, props)
  })) : _createMdxContent(props);
}

export { MDXContent as default, toc };
//# sourceMappingURL=lesson-f5231fbd.js.map
