Skip to content

Commit

Permalink
simpler method for silencing react errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesknelson committed Jul 7, 2016
1 parent 0ebdf05 commit c2082d5
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/pacomo.js
Expand Up @@ -65,16 +65,7 @@ function transformElementProps(props, fn, childrenOnly) {


function cloneElementWithSkip(element) {
const cloned = cloneElement(element)
if (cloned._store) {
// Only available in dev mode
cloned._store.__pacomoSkip = true
}
else {
// Only writable outside of dev mode
cloned.__pacomoSkip = true
}
return cloned
return cloneElement(element, {'data-pacomoSkip': true})
}


Expand All @@ -92,7 +83,7 @@ export function transformWithPrefix(prefix) {
//
// Optionally prefix with a `rootClass` and postfix with `suffixClass`.
function transform(element, rootClass, suffixClasses='') {
if (typeof element !== 'object' || element.__pacomoSkip || (element._store && element._store.__pacomoSkip)) return element
if (typeof element !== 'object' || element.props['data-pacomoSkip']) return element

const changes = transformElementProps(
element.props,
Expand Down

0 comments on commit c2082d5

Please sign in to comment.