score:1
Accepted answer
The setActiveView
prop value you pass to NewPaymentWidgetFooter
is () => setActiveView()
, which will always call setActiveView
without any parameters. If you pass it a function that calls setActiveView
with its parameter, like this
<NewPaymentWidgetFooter ref={footerRef} setActiveView={(n) => setActiveView(n)}/>
it should use the value you pass to the callback.
Source: stackoverflow.com
Related Query
- Function Misbehaving When Passed Down as Prop
- Invoke a function with enzyme when function is passed down as prop - React
- Reducer function passed to useReducer hook is executed multiple times for one dispatch call when reducer function is dependant on a component prop
- Distinguish between img & svg when passed down as a prop in React
- react function undefined when passed to functional component as a prop
- Function passed via a prop to child component is not a function when called
- How to execute a function passed via a prop when a switch/checkbox is checked in React?
- Passing down a prop who's value is calculated when passed down
- Function inside React Functional Component loses context when being passed down to child component
- In React/Redux app, when should I pass down a prop explicitly versus picking it up from global state using mapStateToProps?
- How to spyOn method inside prop passed down to a component using Jest?
- Prevent re-render when sending function prop from functional component
- React onClick event not firing when function is passed to child
- React Array converted to object when passed as a prop to SFC
- WebStorm highlights React component when props passed through react-redux connect function
- Custom widget with input loses focus in react-jsonschema-form when formData is passed as a prop to the form
- React: Can't call prop function when it is inside of another function?
- React/Socket.io not displaying latest message passed down as prop
- Prevent Re-Render when React Element passed as Prop
- React Hooks - function inside function component passed as prop can't access state
- Warning when passing a function to a wrapped component prop
- How to type async function passed as prop to React component
- Using React Hooks, when I pass down a prop from parent to a child component, the prop in the child component is undefined
- State value not updating when passed as route prop
- React functional components in Array.map are always rerendering when getting passed a function as props
- Prop undefined when passing to a function in another .js file
- React: Unable to access the parent component's function which is passed as prop to child component
- Pass a prop in a Hoc function when this prop is inside the component
- React component not able to dynamically require() an image file when filename is passed down via props
- Call parent function passed as prop in React
More Query from same tag
- react-loadable multiple resource loading not working
- can't pass theme to child components Material-Ui - React?
- How to show and hide a Modal in child component from Parent component?
- Where to put timeout operator in Redux Observable fetching epic
- update two array elements using setState
- can't get @mui 5 styled components to work
- I try to override materialUI inbuilt classes using CSS file, styles are applying all the components in React how to stop overriding styles globally?
- Access to fetch at 'https://randomuser.me/api/?results=4' from origin 'http://localhost:3000' has been blocked by CORS policy:
- ReactJS: Render an object with keys with map
- React ternary operator with array data not working?
- react-csv: downloaded csv breaks tab after " "
- Unit Testing AntD Modal with Jest and Enzyme
- How to use "<Redirect>" inside a function?
- JavaScript onKeyDown event in ReactJs
- Execute javascript code inside script-tag in React jsx
- Unsure of async execution timing for react.js
- Execute code on parent component based on parent component's state changed in child component
- Basic example using React
- Ensuring user permits Microphone access before firing event in React app
- Use onFocus on a div with React and Typescript
- How does hot reloading work?
- Jest snapshot error - PrettyFormatPluginError: wrapper.find is not a functionTypeError
- How to transform the inner state based React app to Redux based?
- How to access input elements from a React function
- Why isn't my Styled component data getting passed into my Button for React?
- update data in Mongo DB even when collection does not exist using node.js and mongoose
- Using React-Query QueryCache from another component
- how can I make a function which will return a number of Schedule Dates that are matching with other Item_date from my database
- ReactJS - How to redirect another page using history.push by passing data?
- Using react Hook, shows missing dependency in case of useCallback