score:0
Accepted answer
why not use curried function?
const createfieldchangedhandler = (
params,
fieldidentifier
) => event => {
if (params) console.log(params);
};
function estateparamslist({ estatetype, category }) {
//... other code
useeffect(() => {
//...other code
change: createfieldchangedhandler(
paramsobject,
param.id
),
//...other code
}, [category, estatetype]);//fixed missing dependency
when you call the change function you should already have the right values in scope:
<field {...params[key]} changed={params[key].change} />
Source: stackoverflow.com
Related Query
- How to get value of useState variable in function that passed to another component
- How to get local state value in the function that is passed as a prop to other component?
- How to get value from useState inside the function
- How to assign a value of a variable from a function in another function in React JS
- How to access a variable or a value of a function inside another function
- How to get the return value of a async function that returns a promise
- How to get the value returned by a function into another class in React
- How to get the value from interface and use it on another function
- how to get updated value of react useState hook from setInterval function in highcharts?
- How to know which element was clicked when using map function and how to pass that value to another component?
- How to mock a variable in ES6 Module with jest such that the actual function runs with mocked value
- how to test if a function has been called that isn't passed as props from another component?
- How to get a user input value and display another element based on that in React?
- How to get value from a react function within a react component
- How to get latest component variable value in 'useEffect' hook?
- How to test function that passed from mapDispatchToProps (React/Redux/Enzyme/Jest)
- How to avoid the useState function parameter (to get initial values) from being executed on every render?
- React, can't access updated value of state variable inside function passed to setInterval() in useEffect()
- How to test that ReactDOM.render and another imported function were called in Jest?
- How can I create a reusable function that will setState for a variable object property?
- React How to return div and variable value for another component
- How to typecheck a generic function using a value of that same generic type in Flow
- How to pass a value for useState hook from another component in ReactJS?
- React.js How to pass a variable from another js file that does not have export
- how to get a Component variable from another component but their both in the same file React
- how to use two useState in one function so that the second useState can use the first updated useState?
- Get object array from axios and using return value call another axios function and append the output to first result
- How to update a reused variable using the same function without isolating it into another component?
- How do I get the selected value from the select to another component?
- How to get only one value in a variable of parent component, by selecting and switching to any of the option in reactjs?
More Query from same tag
- React, Node axios not working but fetch is working
- React JS: Use environment variables to specify two API urls based on production vs development
- How to make table take up all horizontal space TailwindCSS (React)
- Pass a component as props
- Call a function from another file in ReactJS
- How to import a sound file into react typescript component?
- className conditions not dynamic?
- Importing multiple files in react
- Gatsby's StaticQuery renders nothing
- Mapping array in React gives .map is not a function
- ComponentDidMount issue in React for rest api
- How to Render React Components with Data from localStorage?
- How do I get data on a specific id from firestore in react?
- Handle datagrid pagination with React/Redux
- How can we pass a color as a prop?
- Displaying API data from an array within the response
- how to disable datepicker depending on value in select tag in ANTD table
- How to display loading indicator during async call
- using useRef Hook "element.current" is null inside useEffect Hook
- Material UI | How to change the font colour of a disabled input text field?
- How can you set path of match with MemoryRouter and Jest? (not location or history)
- react / functional component / props changed / getDerivedStateFromProps
- ReactJS communicate with Webview in Native Android ('Android' is not defined no-undef)
- Change State using OnClick event on REACT TSX
- Since updating react-dom and react-router-dom packages: excessive li onClick behavior
- Toggle one list item at a time with React/TS functional components
- Rendering properties based on checkboxes being selected
- "Multipart/form-data" is not woking in React-redux form upload
- How do I get the return type of a function to be the input of another function in the same interface
- Immutable Data Structure - Application maintenance