Lucifier129 / react-lite

An implementation of React v15.x that optimizes for small script size
MIT License
1.73k stars 100 forks source link

Error when modifying elements using jQuery #103

Closed fellmann closed 7 years ago

fellmann commented 7 years ago

When using jQuery to modify elements, two exceptions may occur:

On update:

Uncaught` TypeError: Cannot read property '3' of undefined
    at updateVcomponent (react-lite.js:462)
    at applyUpdate (react-lite.js:122)
    at flatEach (react-lite.js:1792)
    at flatEach (react-lite.js:1790)
    at updateVChildren (react-lite.js:102)
    at updateVnode (react-lite.js:88)
    at compareTwoVnodes (react-lite.js:593)
    at Klass.forceUpdate (react-lite.js:814)
    at shouldUpdate (react-lite.js:867)
    at Updater.updateComponent (react-lite.js:698)

When unmounting:

Uncaught TypeError: Cannot read property '3' of undefined
    at destroyVcomponent (react-lite.js:491)
    at destroyVnode (react-lite.js:157)
    at destroyVelem (react-lite.js:372)
    at destroyVnode (react-lite.js:154)
    at destroyVelem (react-lite.js:372)
    at destroyVnode (react-lite.js:154)
    at destroyVelem (react-lite.js:372)
    at destroyVnode (react-lite.js:154)
    at applyDestroy (react-lite.js:135)
    at flatEach (react-lite.js:1792)

Although this approach is not recommended, it works in React and fails in react-lite.

Minimal example: https://jsfiddle.net/kavLqzby/2/

Lucifier129 commented 7 years ago

Sorry, react-lite can not support this approach, it just follow the best practice of React.

fellmann commented 7 years ago

Ok, thanks for the answer! Maybe useful to document under "React-lite vs React".