Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react useref file input

const App = () => {
  const inputRef = useRef(null);
  const [file, setFile] = useState(null);
  return (
    <>
      <input
        ref={inputRef}
        accept=".pdf"
        style={{ display: "none" }}
        id="raised-button-file"
        multiple
        type="file"
        onChange={e => {
          setFile(e.target.files[0]);
        }}
      />
      <label htmlFor="raised-button-file">
        <button component="span">
          <span>file</span>
        </button>
      </label>
    </>
  );
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: build apk react native 
Javascript :: javascript sort by id 
Javascript :: Function in JavaScript that can be called only once 
Javascript :: javascript onclick display none 
Javascript :: next js tailwind 
Javascript :: Error: Could not symlink include/node/common.gypi /usr/local/include/node is not writable. 
Javascript :: input text react 
Javascript :: node mon in loopback 
Javascript :: delete slash commands discord.js 
Javascript :: Autocomplete height adjust in materil ui 
Javascript :: how to remove element from array react native 
Javascript :: angular remove item from localstorage 
Javascript :: .sequelizerc File Setup 
Javascript :: js reverse str case 
Javascript :: how to do a classname variable and string react 
Javascript :: Could not resolve dependency: npm ERR! peer reac 
Javascript :: Codewars Convert a String to a Number! 
Javascript :: how to take an element out of an array in javascript 
Javascript :: how to disable right click on website 
Javascript :: js detect hash change 
Javascript :: close bootstrap modal with javascript 
Javascript :: react input number 
Javascript :: javascript add quote comma 
Javascript :: json user data file sample 
Javascript :: create copy button react native 
Javascript :: stateprovider.js react 
Javascript :: get attribute value jquery 
Javascript :: get uploaded file name in js 
Javascript :: show div with jquery 
Javascript :: react app.js 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =