ttag icon indicating copy to clipboard operation
ttag copied to clipboard

feat: update jt to add keys to react elements

Open morganney opened this issue 4 years ago • 0 comments

Addresses https://github.com/ttag-org/ttag/issues/166.

Adds an optional peer dependency on react and uses isValidElement and cloneElement to add keys to jt expressions that are React elements and do not already have a key defined.

Chose to bump the major version because this would be a breaking change for current users of jt who did not previously have react as a dependency.

Now you can safely use jt with JSX expressions without manually adding a key prop (which is an uncommon pattern when defining JSX outside of .map).

morganney avatar Sep 27 '21 20:09 morganney