2021-03-26 17:25:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
2021-03-27 03:18:11 +08:00
|
|
|
import './app.scss'
|
2021-03-26 17:25:28 +08:00
|
|
|
|
2021-03-28 20:00:31 +08:00
|
|
|
import { Provider, useDispatch, useSelector } from 'react-redux'
|
|
|
|
import { renderInst } from './index'
|
|
|
|
|
2021-03-27 03:18:11 +08:00
|
|
|
export const Root = ({ store }) => (
|
2021-03-26 17:25:28 +08:00
|
|
|
<Provider store={store}>
|
2021-03-27 03:18:11 +08:00
|
|
|
<App></App>
|
2021-03-26 17:25:28 +08:00
|
|
|
</Provider>
|
|
|
|
);
|
2021-03-27 03:18:11 +08:00
|
|
|
|
|
|
|
const App = () => {
|
2021-03-28 20:00:31 +08:00
|
|
|
const dispatch = useDispatch()
|
|
|
|
const sketches = useSelector(state => state.sketches)
|
2021-03-27 03:18:11 +08:00
|
|
|
|
|
|
|
return <>
|
2021-03-28 20:00:31 +08:00
|
|
|
<button onClick={() => dispatch({ type: 'toggle', payload: true })}> true</button>
|
|
|
|
<button onClick={() => dispatch({ type: 'toggle', payload: false })}> false </button>
|
|
|
|
<button onClick={renderInst.addSketch}> addsketch </button>
|
|
|
|
|
|
|
|
<div className='feature-tree'>
|
|
|
|
{sketches.map((e, idx) => (
|
|
|
|
<div key={idx}>{e}</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
|
2021-03-27 03:18:11 +08:00
|
|
|
</>
|
2021-03-28 20:00:31 +08:00
|
|
|
}
|
|
|
|
|