Nevertheless! Party Metaphorically

    react-jsvn

    1.3.4 • Public • Published

    REACT-JSVN

    React render for JSVN.

    JSVN

    https://www.npmjs.com/package/jsvn

    Example

    import $$, { View }        from 'jsvn';
    import render              from 'react-jsvn';
    import React, { useState } from 'react';
    import ReactDOM            from 'react-dom';
    
    //Simple View
    const MyView = new View({
    	//CSS (static) Styles
    	background : '#eee',
    	width      : '200px',
    	textAlign  : 'center',
    
    	//Child nodes
    	[$$('/input')]: { //Node base on "<input/>" tag
    		__bind: [env=>env.myText, env=>env.setMyText],
    	},
    
    	[$$()]: { //Node based on "<div></div>" tag (base by default, equal to "[$$('<>div')]")
    		__IF: env=>env.myText,              //Condition for rendering
    
    		[$$()]: 'Hello ',                   //Text node
    
    		[$$('<>span')]: {                   //Node based on "<span></span>" tag
    
    			color      : env=>env.myColor,  //Inline (dynamic) style
    			fontWeight : 'bold',            //CSS (static) style
    
    			[$$()]: env=>`${env.myText}!`, //Text node with dynamic text
    		},
    	},
    });
    
    //Simple React Component
    const MyComponent = props => {
    	const [ myText, setMyText ] = useState('world');
    
    	return render(MyView, { ...props, myText, setMyText });
    };
    
    //Render to root
    ReactDOM.render(
    	React.createElement(MyComponent, {
    		myColor : '#090',
    	}),
    	document.getElementById('root'),
    );
    

    Installation

    npm

    npm i react-jsvn
    

    yarn

    yarn add react-jsvn
    

    Install

    npm i react-jsvn

    DownloadsWeekly Downloads

    0

    Version

    1.3.4

    License

    MIT

    Unpacked Size

    13.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • mothgears