not able to update state of materialui inputswitch, i am making a page with dynamic label and value but thing is i dont know how to update it then

Viewed 14

i need to make it dynamic and update the updated details in database so i dont know how to do it plzzz help i am doing it but the problem is if i will make dynamic then i am not able to make any change in the state of inputswitch in the code

                                useEffect(() => {
        fetch(url, {
            method: "GET",
            headers: {
                "Content-Type": "application/json",
                tnant: "T01RAAA",
            },
        }).then((result) => {
            result.json().then((data) => {
                console.log(data);
                setConnections(data);
            });
        });
    }, []);    
                                                  
                                    
                                    <div className="column">
                                {connections.map((each) => {
                                            return (
                                                <div className="columns">
                                                    <div className="column">
                                                        <label style={{                                                         fontFamily: "Roboto", fontSize:                                                     "20px" }}>{each.name}                                                                 </label>
                                                    </div>
                                                    <div className="column"                                                       style={{ marginTop: "4px" }}>
                                                        <InputSwitch checked=                                                             {each.value}  />
                                                    </div>
                                                </div>
                                            );
                                        })}
                                </div>

enter code here database

0 Answers
Related