Questions tagged [ref]

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 ...

0
votes
0answers
4 views

how to define nested array object in swagger 2.0

I try to define an object array in swagger as response: /product: get: operationId: api.product.read_all tags: - Product summary: Read the Products description: ...
0
votes
0answers
20 views

Reference value does not get the new value assigned inside a method passed as a parameter [duplicate]

Can somebody explain me why this code does not work? void Main() { var person = new Person { Name = "Name", Age = 26 }; Employee employee = new Employee(); Mapper(person, ...
0
votes
0answers
25 views

how to use InnerRef React with map?

how to set properly innerRef and then get value ? {about.map((entry, index) => <Div1 key={index}> <String type='text' innerRef={x => { this.index = x }} ...
3
votes
1answer
208 views

Is access to fields VIA `ref` parameters guarded by lock statements in the CALLED method?

Given, private object _x; private object LoadAndSet(ref object x) { // lock established over read and update lock (somePrivateObjectNotUsedElsewhereThatIsIrrelvantToTheQuestion) { if (x ...
1
vote
1answer
41 views

Call redux-connected component from React using ref

Trying to make a call to component's function from its parent using ref. The component is connected to Redux. Using React ^16. Says that: TypeError: this.usersTable.getWrappedInstance is not a ...
0
votes
1answer
32 views

How to assign class property to point on Windows form variable

I have class KeyWordsManager public class KeyWordsManager { public Designation designation { get; set; } public KeyWordsManager(ref Designation design) { this.designation=design; } } And i have my ...
2
votes
1answer
28 views

Aurelia ref attribute in child container

I have a parent component where the view model contains a property prop1. In its view, a custom element has a view-model.ref="prop1". export class Parent { public prop1; } <template> <...
0
votes
1answer
61 views

'ref is not a prop' even when using ref example from docs

I get this warning: Warning: CreatableSelect: `ref` is not a prop. Trying to access it will result in `undefined` being returned. I use ref in intended way as documentation says, pretty much copy ...
0
votes
0answers
13 views

How to remove scrollIntoView in componentWillUnmount

I used refs to manage the scroll event <section ref={(tasks) => { this.tasks = tasks }}> I am using scrollIntoView to scroll to a particular div on a ...
0
votes
1answer
32 views

React: understanding refs and targeting child refs

I have a react app organized like so: class AppLayout extends Component { componentDidMount () { this.data = this.getEndpoint('some endpoint') } ... render () { return ( <...
-2
votes
0answers
35 views

C# Windows Forms product list with a Array of the Elements

I have test to do and I didn't really know how to solve it. The Question is: "Make a structure where you can manage the items you bought. You need to have columns where you list the article name,...
2
votes
1answer
92 views

How to replace refs in REACT.js (antd table example)

I am trying to apply this example to my own code, but it seems that "ref" properties are obsolete in this form. Can anyone help me with this code? Right now i am getting "Cannot read property 'focus' ...
0
votes
2answers
35 views

React, dynamically add text to ref span

I'm trying to render a message to a span tag specific to an item in a list. I've read a lot about React 'refs', but can't figure out how to populate the span with the message after it's been ...
0
votes
0answers
29 views

Using params with ref keyword in C# [duplicate]

I want to pass a variable number of arguments to a function so I used params keyword, but I also want to pass those arguments as reference. I tried by adding the ref keyword but Visual Studio shows ...
0
votes
2answers
30 views

undefined is not an object (evaluating 'this.refs.loaderRef.hide')

here is my store class ......... import Loade from './utils/Loader'; export default class store extends Component { ................. render() { return ( <View style={...
0
votes
2answers
42 views

How get refs.value in styled-component React?

I want get ref value of input, without styled component: <form role='form' method='POST' onSubmit= {::this.onSubmit}> <input id='name' type='text' ref='name' name='name' ...
0
votes
2answers
52 views

Async initialization of properties

I am trying to refactor loading individual properties with an async method. The loader function is this: public static async Task<Preferences> GetPreferences( string key ) ... It is currently ...
0
votes
2answers
49 views

React ref a nested component

I ran into an issue which I do not know how to "properly" solve. I have two components, let's call them parent and child. child component is "generated" by a call to a function that creates it, let's ...
0
votes
0answers
21 views

Why ref loses reference to the actual DOM element?

As shown below, every onclick event in the CustomNode will trigger the inputNode to dispatch a dom event. Somehow it prompts dispatchEvent is not a function. It seems the ref doesn't reference to the ...
3
votes
1answer
44 views

why add ref to child ref can only get a component instance rather than a DOM node?

I am reading this doc, where it says: While you could add a ref to the child component, this is not an ideal solution, as you would only get a component instance rather than a DOM node. ...
0
votes
0answers
35 views

$ref from child component is always undefined in parent(vuejs)

For some reason when trying to grab the ref for the child component I am getting undefined even when only asking for it later then lifecycle events of mounted and created. Here is the child component: ...
0
votes
1answer
43 views

Accessing The Ref of a Component Passed Down as Props?

I am passing down a styled component const Text = styled.span` font-size: 10px ` render(){ <Test comp = {<Text innerRef={(ref)=>{this.ref=ref}}>Hello</Text>}/> } Inside ...
-1
votes
3answers
25 views

C# out parameter for delegate not maintaining value [duplicate]

I have a function which takes a custom delegate as parameter in order to achieve the following: delegate T TryParseDelegate<I,O,T>(I input, O output); private string[] ReadMultiStringValue (...
1
vote
2answers
42 views

Keyword Ref required at sub-use of Ref?

I found this method at this question public static void RemoveAt<T>(ref T[] arr, int index) { for (int a = index; a < arr.Length - 1; a++) { arr[a] = arr[a + 1]; } ...
0
votes
1answer
56 views

Unable to setup OpenLDAP as primary user store for wso2is 5.6.0: LDAP Error 65 when adding a new user in management console

I am unable to setup WSO2 Identity Server v5.6.0 with OpenLDAP as primary, external user store. The Identity Server is starting as expected (no errors in the console) and the admin user account has ...
0
votes
0answers
33 views

how to access other component in React

I would like to ask if I have 3 components which are not parent-child(please don't ask me to join the 3 buttons into one component) relationship as below, I can use redux to edit value input3 by ...
0
votes
1answer
26 views

REACT using Ref

is it true, the purpose of Ref is replacing document.getElementById?? Once i apply react, i should not use document.getElementById to access DOM to get data? i found some article said that we can ...
2
votes
2answers
61 views

Deleting main object by deleting reference

I am working with large nested dictionaries, and am trying to delete nested subdictionaries. I am wondering why the following behavior occurs. When I set a reference to dictionary d (called ref), ...
6
votes
1answer
84 views

Is there some way/alternative to use System.Collections.Generic.List<T> with ref return values?

Now that C# supports ref return values, is there some way (or alternative) to use List<T> where T is a value type and get ref from the indexer? From the documentation it seems that it returns ...
3
votes
1answer
106 views

Corrupt contents in NodeJS ref-struct upon garbage collection

Nesting a ref-struct instance within another, one of the properties of the nested object is corrupted upon manual garbage collection. See this minimal code reproduction: https://github.com/...
1
vote
1answer
37 views

How to get access to CSS values from a styled component (React)?

I want to access the CSS values I assigned to a styled component in a function. How would I do so? For example: const Hello = styled.p ` font-size: 10px; `; getFontSize = () => { } I want ...
1
vote
2answers
241 views

current is always null when using React.createRef

I was trying to do this. I must be missing something, but I don't understand why current is always null in this example. class App extends React.PureComponent { constructor(props) { super(...
0
votes
1answer
89 views

React ref: what is equal to document.querySelectorAll

I have just started with React refs, and I would like to select all icons of ref=this.contentRef. With js I would do it like this: document.querySelectorAll('.content i'). How to do this with the ref? ...
0
votes
1answer
37 views

The clientWidth property of ref button return undefined

Using the targetButton refs to get the Button dom, and I want to get clientWidth property when click this Button. import React from "react"; import styled from "styled-components"; const Container = ...
-6
votes
1answer
93 views

Memory allocation for 'Ref' and 'Out' parameter, any difference? [duplicate]

In C#, ref and out keyword. How to it affect memory management? Is there any difference in memory management for ref and out keyword?
0
votes
0answers
51 views

How to pass ref by props to a child component in ReactJs?

I need to pass a ref of the parent (parent) component to make a function in the child (child) component. This is a part of my code: Parent <div ref={(chat) => this.chat = chat}> <...
-1
votes
1answer
70 views

How to pass ref by props in ReactJs?

This is my components logic: component_1 | '------component_2 I have an input in component_2, and I want to put .focus () on it, but the function that will do this is in component_1, how ...
1
vote
1answer
46 views

Vuejs dynamically added ref undefined

I'm trying to create a little data editor. A click handler will add an child item inside a parent category like so: methods: { addBlank: function(parentKey){ var obj = {} obj.id = Math.floor((...
4
votes
0answers
69 views

how to work with references using ffi?

I have folowing c++ function compiled with node-gyp. void InterfaceTestOne(const string & mytest) { const string *ptr = &mytest; printf("The variable X is at 0x%p\n", (...
0
votes
2answers
28 views

C#: Why is Networkstream.Read() able to change the buffer variable without out/ref keyword

Why can NetworkStream.Read() write to the byte[]? byte[] data = new byte[16]; NetworkStream ns = new NetworkStream(socket); ns.Read(data, 0, data.Length); //data != new byte[16] I thought you need ...
0
votes
1answer
23 views

Dynamically generated input fields - how to access value

I am developing a spa in reactjs. One of my components maps over an array, and generates subcomponents which contain input boxes, that look like this: <div> <textarea placeholder="...
-1
votes
1answer
45 views

ref doesn't work (react js)

Hey I read the ref doc (https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element) and tried to do the same but that doesn't work despite of the same lines add : import React ...
0
votes
0answers
28 views

Create references in R

I used the package "ref" for creating and using references to objects such as data frames (see sample code part below). That worked really good. But now I switched over to the new R version and when ...
1
vote
2answers
244 views

React Native ref in Flatlist items. Returning for last item alone

I'm creating a list of collapsible using the react native flatlist component. I'm using ref attribute to get the item clicked. But when i try to access the ref from the click event, it doesn't take ...
0
votes
1answer
168 views

'this.$refs' is always empty in parent component

I'm trying to do a standard implementation of ref so that I can insert children elements into my InfoBox. But whatever I seem to put as a 'ref' element, never makes it to my InfoBox component. The ...
0
votes
0answers
71 views

refs in React - React.createRef() - Module build failed: SyntaxError: Unexpected token [duplicate]

Trying to implement a relative simple input form via using some Refs. Unfortunately I get always a "Module build failed: SyntaxError: Unexpected token" error. Tried to do it how it is recommended in ...
1
vote
1answer
338 views

Using 'ref' on React Styled Components is not working

I am having difficulty using refs with Styled Components. When I try to access them in my class methods like below, I get the following error: Edit.js:42 Uncaught TypeError: this.....contains is ...
1
vote
2answers
52 views

how to make an Action that points to another Action C#?

I've ran into some unexpected behavior in c#. I'm basically trying to assign an action to a reference of another action, so that I can subscribe/unsubcrib methods to the referenced action at a later ...
2
votes
2answers
291 views

how to define ref type by flowtype?

I trying to define type of ref by flowtype in react v16.4.0 But I couldn't resolve it, so please let me know how to define it. these are sample code. I want to know how to define ref of Props type. ...
2
votes
1answer
56 views

Should I be using React State for user-interactions (to toggle visibility classes)?

I am developing a UI library and some of my components change their "state" based upon some interaction from the user. For example, a user clicks on an accordion panel's title which causes the ...