forwardRef calls aren't in your own code, they are in the packages that you are using.
styled.button appears to be from
styled-components. This package uses
forwardRef to forward any
ref that you set on your styled button component to the underlying
button component. You can see it in their source code right here:
WrappedStyledComponent = ((React.forwardRef(forwardRef): any): IStyledComponent);
forwardRef began with styled-components v4 -- see step #2 on this migration guide:
Make sure your application is using react >= 16.3; internally we are using the new
React.forwardRefAPI and new context APIs if you wish to try and polyfill for older React version support
It is also explained on this Tips and Tricks page:
Refs to DOM nodes
styled-components makes use of the new React 16.3 API
forwardRef. Thus, set refs like you would on any other component and they will automatically resolve to the underlying DOM element or wrapped component class instance.
- What does forwardRef by a component in React dev tools mean and how can I use it?
- React - How can I let visitors use react dev tools but can not edit states and props
- What does jest.fn() do and how can I use it?
- How can I use useEffect in React to run some code only when the component first mounts, and some other code whenever an event occurs (repeatedly)?
- How can I use React Router to nest some routes? And I want to keep a header component
- What does "TypeError: props.data.map is not a function" mean and how to solve it in react
- How Snapshot testing works and what does toMatchSnapshot( ) function do in Jest Snapshot testing for React components?
- how to import HTML file into React component and use it as a component?
- How does React router works and what is the difference between <link> and<Route>
- React Typescript how send props and use it in child component
- Why does React dev tools show my component as Anonymous?
- React Dev Tools does not show Component Names or State Variable Names
- What is checksum in React and how to use it?
- How can I export a React Component as an NPM package to use in separate projects?
- What does "type" mean and is there is a special use for a question mark in ECMA 6?
- React - How to Export Multiple Components on same File, preventing <Unknown/> Component on Dev Tools
- How can I use react useContext , to show data from context, in the same component
- How can one use a polymer component inside a react component ? Is it possible?
- What is parent-child coupling in react and how does it relate to context?
- How to use React dev tools with react native?
- How does React update a component and its children after a state change?
- How can I use a React component within a Node script?
- How can I access to change styles of inner items of a component in react and material ui?
- How do I use types defined by @types/redux-form in React component with Field and FieldArray?
- I use React js and Material-UI. How can i validate "correct" green color validation on button submit click?
- How can I use a react component in a function?
- How react functional component can use object variable which declared behind the usage? (include example)
- How can I use a loop to make this React component more DRY?
- How can I use ComponentName.js instead of index.js when importing React component (from Atomic design structure directory)
More Query from same tag
- How to use a Array as a prop for React component
- React / Enzyme: Invariant Violation error when running Jest / Enzyme test
- React component not re-rendering on state change due to Memoize
- Change/control checkbox checked state depending on the data resolved from the promise
- React.Component.defaultProps objects are overridden, not merged?
- react .map doesn't update data from array
- Value is undefined from action while using react-redux, instead of payload
- How to display corresponding image from selected item in React using hooks
- value is changing when storing in state
- Controller does not working for MUI Select and React Hook Form. TypeError: props.render is not a function
- How to access a parent's current state from function passed to child
- Toggle the check box on and off, and console log the id's of the selected checkboxes. How can i do that?
- correctly redirect user if refresh token has expired using axios
- React - clearing an form data after form submit
- JSON.Stringify | Output the result on the screen with quote tags ''
- react dc.js import not working
- Array passed as prop gets accepted as a string
- React styled-components navbar styling not working
- react draggable window off the screen in Full Screen mode
- How mock constructor variables in react js test cases file?
- React CDN based page not working with Babel 6.1.19
- How do I initialize constructor and state in a Gatsby arrow function component?
- How to push into an array on submit in reactjs?
- useState Inside Async Function Throws TypeError
- Is it optional to use value for input in Controlled component in React
- Filter array of objects by another array with duplicate keys
- Module not found: Can't resolve 'x' in 'y' from Package Registry
- React: Setting useState() hook clears out input fields?
- Why need front end stores firebase token?