title: Change data displayed in RadioButton.Item React Native
body: <p>In my code I am looping through an array of data and displaying that data as Radio button alternatives. What I want to do is to take away the item that the user has chosen from the other lists that are rendered. I have only succeeded to take away the data from the current list that the user has expanded, not from the other ones.</p>
  <p>My code:</p>
  <pre><code>
  import React, { useState} from 'react';
  import { useEffect } from 'react';
  import { StyleSheet } from 'react-native';
  import {RadioButton, List} from 'react-native-paper';
  import { useDispatch } from 'react-redux';
  import { useSelector } from 'react-redux';
  import { theme } from '../../../../utilities/themes';
  import * as firebaseAction from '../../../redux/actions/firebaseActions';
  
  
  export default function ChoicesComponent({props, callback}) {
      const dispatch = useDispatch();
      //const getDataFsRedux = useSelector(state =&gt; state.firebase.fsData);
      //const getDataFsRedux = useSelector(state =&gt; state.firebase.fsData);
      const getSceduelesFsRedux = useSelector(state =&gt; state.firebase.fsDataSchedueles);
      const [value, setValue] = React.useState('Klicka för att välja svar');
      const [expanded, setExpanded] = React.useState(false);
      const [schedueleArray, setSchedueleArray] = useState(null);
      const [testing, setTesting] = useState(false);
      const [newArray, setNewArray] = useState(getSceduelesFsRedux);
  
      const docName = &quot;turlistor&quot;
  
      //let newArray = null;
  
      const handlePress = () =&gt; setExpanded(!expanded);
  
      useEffect(() =&gt; {
  
          callback({id: props.id, text: value});
  
  
          if(getSceduelesFsRedux !== null ) {
              setNewArray(getSceduelesFsRedux.turlistor)
  
              //setTesting(!testing)
              //console.log(&quot;NEW get cheduele data.length: &quot;, getSceduelesFsRedux.turlistor.length)
              //console.log(&quot;NEW get data is not null&quot;)
              //newArray = getSceduelesFsRedux;
              //console.log(&quot;NEW array before change: &quot;, newArray)
              // if (getSceduelesFsRedux.turlistor.includes(value)) {
              //     const nArray = getSceduelesFsRedux.turlistor.filter(item =&gt; item !== value)
  
              //     console.log('TAG New array, ', nArray)
              //     //console.log(&quot;NEW ARRAY: &quot;, nArray)
  
  
              //     setNewArray(nArray)
                  
  
              //     console.log(&quot;::::::: includes value :::: &quot;)
              //     console.log(&quot;value: &quot;, value)
              // }
          }
  
  
      }, [value, getSceduelesFsRedux, expanded]);
  
    return (
  
          &lt;List.Section&gt;
              &lt;List.Accordion title={value} expanded={expanded} onPress={handlePress}&gt;
                  &lt;RadioButton.Group onValueChange={newValue =&gt; {setValue(newValue)}}value={value}&gt;
  
                      {/*getSceduelesFsRedux ? getSceduelesFsRedux.turlistor.map((item) =&gt; (
                          &lt;RadioButton.Item color={theme.colors.primary}
                          key={item.id}
                          label={item}
                          value={item}
                          /&gt;
                      )) : 'Loading'*/}
  
                      {newArray ? newArray.map((item) =&gt; (
                          &lt;RadioButton.Item color={theme.colors.primary}
                          key={item.id}
                          label={item}
                          value={item}
                          /&gt;
                      )) : 'LOADINNGNGNNGNG'}
  
                  &lt;/RadioButton.Group&gt;
              &lt;/List.Accordion&gt;
          &lt;/List.Section&gt;
    );
  }
  
  const styles = StyleSheet.create({
    list: {
      
    },
  });
  </code></pre>
  <p>This is how my list looks like: <a href="https://i.stack.imgur.com/8kBGF.jpg" rel="nofollow noreferrer">Theese are the lists that can be expanded, there are 6 lists to expand and each list has there alternatives</a></p>
  <p><a href="https://i.stack.imgur.com/8a2J6.jpg" rel="nofollow noreferrer">When a user chooses an alternative here I want to take it away from thee next list that the user expands.</a></p>
  <p>I have been stuck for days! I have been stuck in my own thinking bubble.</p>