National Preventative Mechanism

    react-jsvn

    1.3.8 • Public • Published

    REACT-JSVN

    React render for JSVN - ES2020 JSX alternative with class inheritance

    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({
    	background : '#eee',
    	width      : '200px',
    	textAlign  : 'center',
    	color      : m=>m.myColor,
    
    	[$$`my-title`]: {
    		$: 'JSVN Example',
    	},
    
    	[$$`my-input `('/input')]: {
    		_bind: [m=>m.myText, m=>m.setMyText],
    	},
    
    	[$$()]: {
    		_IF: m=>m.myText,
    		
    		fontFamily: 'Tahoma, sans-serif',
    
    		[$$()]: 'Hello ',
    
    		[$$('<>span')]: {
    			fontWeight : 'bold',
    
    			$: m=>`${m.myText}!`,
    		},
    	},
    });
    
    //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

    10

    Version

    1.3.8

    License

    MIT

    Unpacked Size

    12.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • mothgears