npx vikk-app project
npx vikk-app # in current folder
npx vikk-app -js # javascript
bunx vikk-bun # using bun
function App() {
return <div> Hello from Vikk </div>
}
document.body.append(<App />)
<div style="color: red"> Hello </div>
const f = (text) => alert(text)
<div onclick={() => f("Hi")}> Click Me </div>
<div> {[1, 2, 3].map(i => <div> {i} </div>)} </div>
<div> {true ? <div> Hello </div> : null} </div>
const inner = <div> Hello </div>
<div> {inner} </div>
const style = { color: "red" }
<div style={style}> Hello </div>
function Component({ state }) {
return <div> {state.data} </div>
}
function App() {
const state = { data: "hello" }
return <div>
<Component state={state} />
</div>
}
function Component({ param1, param2 }) {
return <div> {param1} {param2} </div>
}
function App() {
return <div>
<Component param1="hello" param2="world" />
</div>
}
function Component({ state }, children) {
return <div>
{state.data}
{children}
</div>
}
function App() {
const state = { data: "hello" }
return <div>
<Component state={state}>
<div> child1 </div>
<div> child2 </div>
</Component>
</div>
}
function Component(state) {
return <div> {state.data} </div>
}
function App() {
const state = { data: "hello" }
return <div>
{Component(state)}
</div>
}
function App() {
const input = <input />
const list = <ul></ul>
const add = () => list.prepend(<li> {input.value} </li>)
const btn = <button onClick={add}> Add </button>
return <div> {input} {btn} {list} </div>
}
document.body.append(<App />)
MIT