In order to be compatible with antD, the most famous UI library in China, AnuJs1.1.1 has made a lot of improvements in the compatibility of virtual DOM tree structure, REF mechanism, owner mechanism and SVG. So far, only two components are not compatible, I believe the next version will fix that. Antd internally uses a large number of old API and hack React implementation, so it is compatible with ANTD, for other more formal UI library, AnuJS also can certainly support.

Github.com/RubyLouvre….

Main improvements:

  1. Simplified createClass

  2. Fixed a flattening BUG that eliminates the need to bundle a long line of hooks if they only have one function

  3. Modified the implementation of the virtual DOM tree to be consistent with the official React, i.e., props. Children is now in multiple forms, delaying the creation of vchildren for comparison until diff

  4. Fixed a disposeElement where dangerouslySetInnerHTML was present that required empties inside the element without traversing branches of the sub-virtual DOM

  5. Fix diffProps, elements of SVG that are case sensitive like viewBox preserveAspectRation

  6. When a component updates, it checks to see if the context has changed

  7. Implement the persist method for the event object

  8. This revised unstable_renderSubtreeIntoContainer callback pointing in the direction of the problem

  9. Fixed unmountComponentAtNode BUG, #text changed to #comment

  10. Fix cloneElement BUG to make sure children and _owner are passed correctly

  11. – Fixed the ref mechanism so that if the ref is a string and the owner of the current ref is passed in through createStringRef, a curry method is returned, and the method created by createStringRef at cloneElement is incorporated inside the new ref method. Make sure the old owner is updated again

  12. – Fixed implementation of getNs method (originally using hash table for enumeration, but SVG document also has A, script,style elements, making it impossible to distinguish)

  13. Use setState at componentDidUpdate to slow down the call frequency and prevent the page from getting stuck. React has a similar mechanism.

use



npm i anujsCopy the code

Or use the rack rack github.com/Levan-Du/a….



npm i -g anu-cliCopy the code

How to replace React projects in webpack.config



resolve: {
   alias: {
      'react': 'anujs'.'react-dom': 'anujs'// To be compatibleIE Use the following configuration //'react': 'qreact/dist/ReactIE', / /'react-dom': 'qreact/dist/ReactIE'// If referencedprop-types orcreate-react-class// The following aliases need to be added'prop-types': 'qreact/lib/ReactPropTypes'.'create-react-class': 'qreact/lib/createClass'// If you use it on mobileOnTouchTap thinga'react-tap-event-plugin': 'anujs/lib/injectTapEventPlugin',}},Copy the code

Welcome to add stars and try out anujs!!

Github.com/RubyLouvre….