# getValue

## Description

Returns the value of the component specified by the user. The component value can be displayed in another component using the [`setValue`](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/006-actions-and-visual-logic/action-reference/react-native/Component/getValue/setValue/README.md) function.

## Input / Parameter

| Name        | Description                                                          | Input Type  | Default | Options | Required                       |
| ----------- | -------------------------------------------------------------------- | ----------- | ------- | ------- | ------------------------------ |
| component   | The name of the component that the value is retrieved from.          | String/Text | -       | -       | Yes, if componentId is not set |
| componentId | The component ID to get value from (for components in FlatList item) | String/Text | -       | -       | Yes, if component is not set   |

## Output

| Description                                   | Output Type |
| --------------------------------------------- | ----------- |
| Returns the value of the component specified. | String/Text |

## Example

In this example, we will get the component value of an input field using `Component.getValue` and print it to the console.

### Steps

1. First we drag an input box onto the page. We will name it "InputBox" with the value "This is an input field".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-25b94a1359f93cd2674f2934a800b52e35aed84a%2FgetValue-step-1.png?alt=media)
2. We want to get the value of "InputBox" and display it in the browser console with the help of the `Console.write` helper function.
3. Drag `Component.getValue` into the event flow, and specify the name of the component, which in this case is "InputBox".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-2b1296da02d611d41d8fa94c554b19b386135202%2FgetValue-step-2.png?alt=media)

### Result

1. The value of "InputBox" will be displayed in the browser console.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-d574d1f0f3ffa8b54f9cea4fa70f6fc1df6d6fe1%2FgetComponentValue-result-1.png?alt=media)

## Links

### Related Information

See also:

* Functions
  * [Component.setValue](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/gitbook/2-5-actions-and-visual-logic/action-reference/react-native/Component/setValue/README.md)
