JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Editor & Inputs Does anyone know how to do Input in React?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #112818
    alex.morris22
    Participant

    Are there examples of using Smart.MultiComboInput with state management (like Redux, VUEx, etc.)? How to sync global and local state?

    #112827
    Markov
    Keymaster

    Hi,

    Please, look at https://www.htmlelements.com/demos/input/multi-combo-input/.

    As for state management, you can use something like this:

    // React component
    import { MultiComboInput } from 'smart-webcomponents-react/multicomboinput';
    import { useSelector, useDispatch } from 'react-redux';
    
    const FruitSelector = () => {
        const selectedFruits = useSelector(state => state.selectedFruits);
        const dispatch = useDispatch();
    
        const handleChange = (event) => {
            const value = event.detail.value;
            dispatch({ type: 'SET_FRUITS', payload: value });
        };
    
        return (
            <MultiComboInput
                dataSource={['Apple', 'Banana', 'Orange', 'Grape']}
                selectedValues={selectedFruits}
                onChange={handleChange}
            />
        );
    };

    Best wishes,
    Markov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.