react-elem
Simpler elements without JSX
You can use any order of the function args.
Example:
;const div p h1 ul li a = DOM; { return ;}
No or multiple property objects
All property objects are merged into one.
// equivalent to // this
Text anywhere
Order doesn't matter
// equivalent to // this
Varags elements
Arrays
Function to encapsulate children
Captures nested created elements.
wrap
The basis of react-elem is to wrap a React factory function with another function that has a more flexible argument order. This can be done for any react component.
; // wrapping function; // a standard react component myComponentFn = ; // make wrapped factory function { ;}
wrapall
There's a utility function to wrap all members of an object.
; // mega-function ; // standard react factory functions myDOM = ; // this is exactly what {DOM} is in react-elem
newroot
Starts a new root so that function wrapped children can avoid being captured in the same parent.
;
ISC License (ISC)
Copyright (c) 2016, Martin Algesten martin@algesten.se
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.