import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons'; import { Button } from 'antd'; import { usePlugin, useValue } from 'flipper-plugin'; import React, { useCallback } from 'react'; import { plugin } from '..'; const SchemaHistoryActions = () => { const instance = usePlugin(plugin); const state = useValue(instance.state); const goBack = useCallback(() => { const newSelectedSchema = state.schemaHistory[state.schemaHistoryIndex - 1]; if (!newSelectedSchema) { return; } instance.goBackSchemaHistory(newSelectedSchema); instance.getObjects(); }, [state.currentSchema]); const goForward = useCallback(() => { const newSelectedSchema = state.schemaHistory[state.schemaHistoryIndex + 1]; if (!newSelectedSchema) { return; } instance.goForwardSchemaHistory(newSelectedSchema); instance.getObjects(); }, [state.currentSchema]); return ( ); }; export default React.memo(SchemaHistoryActions);