Using document.querySelector in React? Should I use refs instead? How?

I can’t answer the “should you” part of whether to use refs for this instead other than if you do, you don’t need those id values unless you use them for something else. But here’s how you would: Use useRef(null) to create the ref. const activeSlideRef = useRef(null); Put it on the Slide that’s currently … Read more

PL/SQL print out ref cursor returned by a stored procedure

Note: This code is untested Define a record for your refCursor return type, call it rec. For example: TYPE MyRec IS RECORD (col1 VARCHAR2(10), col2 VARCHAR2(20), …); –define the record rec MyRec; — instantiate the record Once you have the refcursor returned from your procedure, you can add the following code where your comments are … Read more

How to properly reference local resources in HTML?

A leading slash tells the browser to start at the root directory. If you don’t have the leading slash, you’re referencing from the current directory. If you add two dots before the leading slash, it means you’re referencing the parent of the current directory. Take the following folder structure notice: the ROOT checkmark is green, … Read more

Assigning out/ref parameters in Moq

For ‘out’, the following seems to work for me. public interface IService { void DoSomething(out string a); } [TestMethod] public void Test() { var service = new Mock<IService>(); var expectedValue = “value”; service.Setup(s => s.DoSomething(out expectedValue)); string actualValue; service.Object.DoSomething(out actualValue); Assert.AreEqual(expectedValue, actualValue); } I’m guessing that Moq looks at the value of ‘expectedValue’ when you … Read more

tech