DEV Community

Discussion on: Looking for Contributors on CONNECTIVE HTML

Collapse
 
seanmclem profile image
Seanmclem

Looks cool!

const MyComp = ({ name }, renderer) => <div>Hellow {name}!</div>
I don't understand what is happening here ^
It looks like you're passing in the renderer, but not explicitly using it. Why/how?

Collapse
 
loreanvictor profile image
Eugene Ghanizadeh • Edited

<div>Hellow {name}!</div> is transpiled (by some JSX transpiler such as Typescript or Babel) to renderer.create('div', ...). In a library like React, the equivalent would be importing global name React (import React from 'react';), however in CONNECTIVE HTML the decision was made to keep this factory object locally scoped to enable/encourage using context-specific renderers (such as one that scopes styles for current scope/component).