Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 424 Bytes

README.md

File metadata and controls

25 lines (19 loc) · 424 Bytes

use-v-model

Like v-model in Vue... but for React

Only works on <input> and <select> at the moment

import React from "react";
import { useVModel } from "use-v-model";

function App() {
  // can pass default value
  let name = useVModel("Anthony");
  let email = useVModel();

  return (
    <div>
      <input name="name" {...name} />
      
      // Output the value
      {name.value}
    </div>
  );
}