react-immutable-editor

dev-tool: editor for immutable maps in react

Usage no npm install needed!

<script type="module">
  import reactImmutableEditor from 'https://cdn.skypack.dev/react-immutable-editor';
</script>

README

React Immutable Editor

An editor for immutable-js maps in React.

picture

See it in action:

  1. Download git repo: git clone https://bitbucket.org/bemit_eu/react-immutable-editor.git
  2. Install demo setup: npm i
  3. Start server: npm start
  4. Visit shown URL, default localhost:3000

For usage simply npm i --save-dev react-immutable-editor

import React from 'react';
import {ImmutableEditor, themeMaterial} from 'react-immutable-editor';
import {OrderedMap} from "immutable";

/**
 * Get your data in an ordered map
 * @var {OrderedMap} demoData
 */

const ThemedImmutableEditor = (props) => <ImmutableEditor
    theme={themeMaterial}
    data={props.data}
    invertTheme={false}
    // keys is an array that can be used for .getIn and .setIn
    // val is the data that was changed
    onChange={(keys, val) => { /* update your demoData */ props.setData(keys, val) }}
    getVal={keys => { /* get your demo data */ return props.getVal(keys); }}/>

export {ThemedImmutableEditor}

See demo file for the full React example.

License

This project is free software distributed under the MIT License.

See: LICENSE.

Contributors

By committing your code to the code repository you agree to release the code under the MIT License attached to the repository.


Created by Michael Becker