JSFiddle - React, Tailwind, and code Playground

by lluz55

HTML

<script src="https://cdn.jsdelivr.net/npm/@lluz55/lightframework@1.0.0-alpha.28/dist/lightframework.min.js"></script>

CSS

* {
  margin: 0;
  padding: 0;
}

html, body {
  background-color: #f5f5f5;
  text-align: center;
  margin: 70px auto;
}

h1 {
  font-weight: lighter;
  margin-bottom: 30px;
}

input {
  padding: 7px 12px;
  border-radius: 3px;
  border: 2px solid #757577;
  outline: #151515;
}

::placeholder {
  color: #bbb;
}

JavaScript

var App = function() {
  var msg = lf.observable('world');
    
  function SayHello(e){
    var value = e.target.value
    msg.setValue(value !== '' ? value: 'world');
  }

  return lf('div', {}, 
    lf('h1', {}, 'Hello ', msg),
      lf('input', { oninput: (e) => SayHello(e), placeholder: 'Write your name...' }
    )
  )
}

document.body.appendChild(App())