The ref keyword causes an argument to be passed by reference, not by value. The effect of passing by reference is that any change to the parameter in the method is reflected in the underlying argument variable in the calling method. The value of a reference parameter is always the same as the value of the underlying argument variable.
Questions tagged [ref]
1394 questions
-1
votes
3 answers
How to pass refs from child to parent in reactjs?
I want to focus the input box in my child component as soon as it renders and hence I am trying to pass ref of the input box up to its parent, which has a modal. And I am trying to focus on the input on entering the modal. (using the onEntered prop…

Vikrant Bhat
- 2,117
- 2
- 14
- 32
-1
votes
2 answers
How to use "ref" to refer an element in React Stateless Component
I was trying to implement focus for the Submit button with Ref. I wanted to omit refering elements by ID.
import React, { useRef } from 'react'
import PropTypes from 'prop-types'
export const LabelComponent = () => {
const createButton =…

WenukaGTX
- 155
- 1
- 1
- 9
-1
votes
1 answer
React wrong & right practices with form elements
Hyall
Can you please point out bad practices / mistakes in the code below?
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
title: "default title"
};
this.inputTxt = this.state.title;
…

Darchan
- 1
- 1
-1
votes
1 answer
List of properties by ref
I'm trying to generalize a C# class which holds multiple properties of the same type (and all of them have the same implementation as well).
What I want eventually is to remove all properties and hold a single Dictionary which maps…

ZivS
- 2,094
- 2
- 27
- 48
-1
votes
2 answers
How passing multiple parameters as "params" but referenced in C#
I'm looking if there's a way to pass any number of parameters with "params" but referenced in C#
I have a function that return an string, that string is modified inside this function, is something like this:
Main:
var myWord =…

Javier Salas
- 1,064
- 5
- 15
- 38
-1
votes
1 answer
How can I avoid use ref to render loader
I'd like to render loader spinner while im getting data from the server. I have achieved that but I know is not the best way because of using "ref". How can I avoid to use "ref" in this case. Id like to render spinner in other components as well. In…

Paweł Doliński
- 29
- 1
- 9
-1
votes
1 answer
Assigning variable = self creating a copy. Need it to be a reference (pointer)
I am working on creating a matrix class for an assignment I have and usually if I assign a variable as x = self, x is a reference to self and thus all operations are in place. I have a function that reduces the matrix, and as an optional parameter…

Adam Johnston
- 1,399
- 2
- 12
- 23
-1
votes
1 answer
How to return an out parameter when sending a ref parameter?
I am sending a ref parameter; want to return an out parameter. Would I also need to create another method along with the ref method?
This is some context to what I am working on: "Create an internal static void method that receives degrees Celsius…

Aashna
- 5
- 2
-1
votes
1 answer
How shoud I pass a null pointer to c++ function just like IntPter.Zero in C#?
I tried to use a C++ dll by fii,one of the function declared like this:
QCAP_CREATE( CHAR * pszDevName /*IN*/, UINT iDevNum /*IN*/, HWND hAttachedWindow /*IN*/, PVOID * ppDevice /*OUT*/, BOOL bThumbDraw = FALSE /*IN*/, BOOL bMaintainAspectRatio =…

Misland
- 9
- 3
-1
votes
3 answers
C# out parameter for delegate not maintaining value
I have a function which takes a custom delegate as parameter in order to achieve the following:
delegate T TryParseDelegate(I input, O output);
private string[] ReadMultiStringValue (string propertyName, TryParseDelegate

DMX David Cardinal
- 599
- 2
- 7
- 19
-1
votes
1 answer
When does Perl ref($something) return "ARRAY(0x913310)"?
I have some complex Perl code that tests the value of $val = ref($something). Unfortunately my code fails, because there is a situation where $val is "ARRAY(0x913310)" and not "ARRAY" (according to the Perl debugger).
Reading the documentation of…

U. Windl
- 3,480
- 26
- 54
-1
votes
1 answer
How can I make use of React.js refs without a variable?
Given the source code for a simple login form, see below. You see I want to use the username text field's value when I click the form's submit button. Since I need a reference to the actual DOM node to retrieve the value, I'm setting the…

sk22
- 837
- 1
- 10
- 21
-1
votes
2 answers
method call inside method with ref keyword
Hello have an issue when trying to call method inside another method which holds ref element as a parameter.Method "replaceWordInLine" creates new Line and I call it in method "findLine". I should give "replaceWordInLine" method line argument, just…

Lucas
- 35
- 6
-1
votes
1 answer
How to initialize reference in class?
I need something like this
public class Displayer
{
public ref string[] lines { get; set; }
}
But i didn't find any solution.
Full code of my "application" is:
public class Displayer
{
public ref string[] lines { get; set; }
public…

SOCIOPATH
- 72
- 7
-1
votes
1 answer
Clojure: working with refs in a collection
I am working with refs and I need some help.
I have here 2 bank accounts with respective :operations
(ref :name "bank"
:accounts
{12345678 (ref {:name "joey"
:account-number 12345678
…

junis087678
- 71
- 7