score:0
i think the best way would be to wrap your needs into a component and pass it the parent state:
const conditionallyrenderedbutton = (props) => {
const { disablefetch, disablehighetch, disablemidfetch } = props;
const isdisabled = !disablefetch && !disablehighetch && !disablemidfetch;
return(
<button classname="btn btn-primary fetchbtnsize" disabled={isdisabled}>fetch questions</button>
)
}
score:2
ternary operator should do the trick
disabled={(this.state.disablefetch && this.state.disablehighetch && this.state.disablemidfetch)? true: false}
Source: stackoverflow.com
Related Query
- Two logical operators for the disabling the button
- How would I animate the width of a button based on percentage, and the same for it's backgroundColor?
- Trying to flip the position of the OK and Cancel buttons inside an Antd modal using okButtonProps and cancelButtonProps for button position
- How to handle the navigation for the Button click in ReactJS?
- Can I have the same route handler for two routes
- React Navigation - navigate and set history for the back button
- Why is it not possible to have the same name of two StaticQuery elements on two different layouts for Gatsby?
- Hover style '&:hover:{ }' doesn't work for the button within react component
- Using logical operators to conditionally enable/disable button element
- How to test for a `click` event on the icon button of the `material-ui` AppBar?
- Setting the initial value for a radio button group in Formik
- JS Regex for first letters only, but if the word it only two letters keep both AND numbers as is
- How to use React Redux state for conditionally showing and Disabling a Button
- How do I remove the outline for active state on a button in React Bootstrap?
- Using Styled Components with nested styles for React Search Bar, trying to place two different SVGs at opposite sides of the search bar
- Creating a 'Save As' button for a file generated on the server
- My button needs to be clicked twice to render the new component for the first click React
- I used two 'setState' inside a handleChange of input, for searching on the array. why the search is unseccesfull?
- How can I have two headers columns for the same column in a material UI table?
- How to return the data in one function call for two different object keys
- On an HTML form with two buttons, how can I get one button to submit the form and the other one not?
- How can I set a logical operator between two spread operators in ES6
- For object with multiple arrays, return array based on checking two values inside the same array
- React Test case for the button disabled or not on the basis of state value
- Alan AI Error Uncaught Error: The Alan Button instance has already been created. There cannot be two Alan Button instances created at the same time
- How would you hide an edit and delete button for something the user doesn't own
- Two routes with different query strings for the same component
- Firebase generating two different uid's for the same user?
- What can i pass in as placeholder for first argument in map function Warning: Encountered two children with the same key, `[object Object]`
- Chosing first two from the array and the add +(plus) for rest of them
More Query from same tag
- Integrating Auth0 authentication with existing user database
- React Js Text input cursor position for mozilla
- Take input value from submit form and store in redux store to use later
- How to Handle onClick is Null on Shared React Component?
- Passing data to view in ExpressJS + Reactjs
- In reactjs, On hover a row of the table should change background of row of other table with same row index value
- How to update a single key value pair in an array of objects in react?
- Method called on render without click react native
- Having problem with import in ES6 module: property is not exported
- Add custom props to this.props.children in React component
- render array of nested components in react
- load model.json for tensorflowjs in reactjs not working
- Different actions based on response status code in Redux-Toolkit
- Change SVG fill when scrolling based on background color
- Create a numbered list within a textarea element in ReactJs
- Is there any solution to fix this Cors error?
- React router dom redirect problem. Changes url, does not render component
- How to display defaultValues with useFieldArray hook in controlled components in react-hook-forms
- How to call a function inside a callback function
- Can the default value of a recoil atom be an object of objects?
- TypeScript - How do you add comments?
- Is there any way to show the Select MenuItems from specific position at first dropdown?
- Parse FormData [] with array of files - to Controller with saving to PSQL
- Import react from webjars
- Infinite loop in useEffect after an API mock in Jest
- Reactjs dropdown menu not displaying when hovered over the word
- Compiled with problems. in React
- Jest: test components with ESM dependencies
- React limits the number of renders to prevent an infinite loop - react hooks
- Routing inside subcomponents not working while using 'exact' : ReactJs