score:2
Accepted answer
in your component's render:
<div classname="product-intro__images" ref={el => this.productintro = el}>
then:
componentdidmount(){
$(this.productintro).stick_in_parent()
}
you could even do this in the ref callback direct:
ref={el => $(el).stick_in__parent()}
but keep in mind it's not a great idea to mix in stuff that manages dom for you with react code direct and it depends on the plugin - but unexpected behaviour or side effects may occur.
you may also need to cleanup on componentwillunmount(){}
make sure you import $ from 'jquery'
and the plugin as well.
Source: stackoverflow.com
Related Query
- Initialize a jQuery function in React's JSX
- JSX Element type 'void' is not a constructor function for JSX elements
- How to do CSS :hover function in JSX ?
- Type error: JSX element type '{} | null | undefined' is not a constructor function for JSX elements
- JSX element type 'Element[]' is not a constructor function for JSX elements?
- React: jsx in a variable vs a function vs a separate component
- JSX element type 'App' is not a constructor function for JSX elements. Types of property 'setState' are incompatible
- React JSX vs function call to present component
- How to return an empty jsx element from the render function in react?
- how to access vairables outside of map function in js and jsx in a React component
- Advantages of rendering a component vs a function returning JSX [React]
- Using JS React component in TypeScript: JSX element type 'MyComponent' is not a constructor function for JSX elements
- Why doesn't useState function initialize state every time?
- How can I initialize a class instance in a stateless function component in React?
- Immediately-invoked function expression inside JSX
- In Flux/React.js, where to initialize jQuery plugins?
- Passing current element to onClick function - React Jsx
- How to loop inside map function using jsx format React JS
- JSX element type 'ReactElement<any> | null' is not a constructor function for JSX elements
- jsx element type 'yyy' is not a constructor function for jsx elements. property 'yyy' is protected in type 'yyy' but public in type 'elementclass'
- Rendering a component in JSX vs via function
- Return JSX from function
- How do you call a jQuery function on a ReactJS element from .jsx script?
- JSX syntax arrow function inside render
- How can I use jQuery $(this) in react js function
- In React, How to Return JSX together with JS Function that returns more JSX?
- How to use function inside JSX
- How to Separate Jsx inside render function into a separate file in ES6? or any other solution in react to separate the Logic and presentation?
- React component function returning JSX causes error when used in render method of ES6 class React component
- react: using es6 component in ts component: ts2605: jsx element type 'yyy' is not a constructor function for jsx elements
More Query from same tag
- How to make changes by using onChange using <select> in React?
- I need to position image at the bottom of the background image and have them stay in place when window is resized
- Router link giving warning " link is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`."
- Is there a way to "Break out" of a react app with a relative link
- Method “props” is only meant to be run on a single node. 0 found instead in SingleDatePicker
- Conditionally specify props of a component
- Onclicking button change className of the clicked Button and another Button | ReactJs
- How to find all of the style attributes I can edit in ant design component?
- Using React IndexRoute in react-router v4
- How can I open a Modal when clicking on a customized button in MaterialUI?
- How to match string with multiple variables?
- React stale state with useEffect loop
- React Router issue within library - using elements outside <Router>
- FontAwesome icon prop error in Nextjs project
- React: How to refactor this to prevent a whole re-render and encapsulate it towards the component that matters?
- Replace multiple consecutive characters with their last occurrence
- Axios post not passing body parameters
- Warning: Each child in a list should have a unique "key" prop. in react. Actually the array has a key
- How to validate material-ui-phone-number with Yup
- Need to pass the execution of code to get output in Javascript
- react class isn't being exported and I can't figure out why?
- Table creating more table rather than a new row
- Add JavaScript code in React component and calling it
- Arrow function syntax with parentheses instead of curly braces?
- React Hooks add/subtract count from click div/list
- How to unit test an api call and assert state change in react and enzyme?
- react router 4 "Not Found" page with nested routes
- How to fix redirection problems in a react-material menu
- How can I mock a list of users in my redux actions?
- React setState not updating state immediately