🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

forgo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forgo - npm Package Compare versions

Comparing version

to
0.0.29

2

package.json
{
"name": "forgo",
"version": "0.0.28",
"version": "0.0.29",
"main": "./dist",

@@ -5,0 +5,0 @@ "author": "Jeswin Kumar<jeswinpk@agilehead.com>",

@@ -100,5 +100,5 @@ # forgo

You can access and read form input elements using regular DOM APIs.
To access the actual DOM elements corresponding to your markup (and the values contained within them), you need to use the ref attribute in the markup. An object referenced by the ref attribute in an element's markup will have its 'value' property set to the actual DOM element when it gets created.
Like this:
Here's an example:

@@ -112,3 +112,3 @@ ```jsx

function onClick() {
const inputElement = document.getElementById("myinput");
const inputElement = myInputRef.value;
alert(inputElement.value); // Read the text input!

@@ -119,3 +119,3 @@ }

<div>
<input type="text" id="myinput" />
<input type="text" ref={myInputRef} />
<button onclick={onClick}>Click me!</button>

@@ -129,25 +129,8 @@ </div>

But there's also another way to do this, without requiring you to assign an id. An object referenced by the ref attribute in an element's markup will have its value property set to the actual DOM element.
You can access and read form input elements using regular DOM APIs as well. For example, the following code will work just fine if you assign an id to the input element.
So you could do this as well:
```jsx
function Component(props) {
const myInputRef = {};
return {
render(props, args) {
function onClick() {
const inputElement = myInputRef.value;
alert(inputElement.value); // Read the text input!
}
return (
<div>
<input type="text" ref={myInputRef} />
<button onclick={onClick}>Click me!</button>
</div>
);
},
};
function onClick() {
const inputElement = document.getElementById("myinput");
alert(inputElement.value);
}

@@ -154,0 +137,0 @@ ```