File "previous-step-button.js"

Full Path: /home/warrior1/public_html/wp-content/plugins/astra-sites/inc/lib/onboarding/assets/src/components/util/previous-step-button/previous-step-button.js
File size: 533 bytes
MIME-type: text/plain
Charset: utf-8

import React from 'react';
import Button from '../../button/button';
import { useStateValue } from '../../../store/store';

const PreviousStepButton = ( { children, customizeStep } ) => {
	const [ { currentIndex }, dispatch ] = useStateValue();
	return (
		<Button
			type="hero"
			onClick={ () => {
				if ( true !== customizeStep ) {
					dispatch( {
						type: 'set',
						currentIndex: currentIndex - 1,
					} );
				}
			} }
		>
			{ children }
		</Button>
	);
};

export default PreviousStepButton;