-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add react refs docs #221
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under BasisTheoryReact
section let's add a new Element Ref
(or similar) where we have code sample of how to perform tokenization, similar to the getElement
section.
It feels weird that we would be deprecating the latter and not adding examples for Refs.
Be aware of the Typescript type generics passed to useRef
function
source/includes/elements/react/_card_expiration_date_element.md
Outdated
Show resolved
Hide resolved
source/includes/elements/react/_card_verification_code_element.md
Outdated
Show resolved
Hide resolved
``` | ||
|
||
Gets the underlying Element instance. Given the declarative nature of React, this method enables referencing the Element value for tokenization. | ||
[Refs](https://reactjs.org/docs/refs-and-the-dom.html) are a way to access DOM nodes or React elements created in the render method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Refs](https://reactjs.org/docs/refs-and-the-dom.html) are a way to access DOM nodes or React elements created in the render method. | |
[Refs](https://reactjs.org/docs/refs-and-the-dom.html) are a way to access DOM nodes or React component instances. |
|
||
The targeted Element must be present in your component tree (virtual DOM) when invoking this method. | ||
In the case of BasisTheoryReact, `refs` are utilized to store or receive (in the case of a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs)) the created element instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of BasisTheoryReact, `refs` are utilized to store or receive (in the case of a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs)) the created element instance. | |
In BasisTheoryReact, `refs` are utilized to store or receive (in the case of a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs)) the underlying Element instance to tokenize their value or call one of its methods. |
</aside> | ||
|
||
You can type-cast `getElement` method to safely call specific Elements methods. | ||
When using typescript, you can type-cast the element `ref` to safely call specific Elements methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn Tokenization > Data Parsing
into a level 2 heading and link "specific" methods to it, for better clarity.
When using typescript, you can type-cast the element `ref` to safely call specific Elements methods. | |
When using Typescript, you can type-cast the element `ref` to safely call specific Elements methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we introduce focus
and blur
we will have to rethink about methods documentation.
# [1.62.0](v1.61.0...v1.62.0) (2022-08-26) ### Features * add react refs docs ([#221](#221)) ([e256252](e256252))
🎉 This PR is included in version 1.62.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
refs
feature for react elementsTesting required outside of automated testing?
Screenshots (if appropriate):
Rollback / Rollforward Procedure
Reviewer Checklist