Giter Club home page Giter Club logo

markdown-editor's Introduction

Markdown Editor example app

This project was bootstrapped with Create React App.

It implements:

  • Editor component with <textarea> that sends it's contents on change via onTextChange handler
  • Preview component with that dynamically shows text from Editor and parses it with npm's remarkable library

It has three versions

  • on master branch: Initial version with just React and state kept in App component
git checkout master
  • on dev-add-redux branch: Version with redux library added that introduces redux store, actions and reducers (with render method passed to store.subscribe)
git checkout dev-add-redux
  • on dev-add-react-redux-connect: Version with react-redux library added that introduces connect method to provide props (data from state and actions to dispatch) to App component (no explicit store.subscribe needed)
git checkout dev-add-react-redux-connect

Run in development mode

npm install
npm start

Open http://localhost:3000 to view it in the browser

Minimum files set

For the project to build, these files must exist with exact filenames:

  • public/index.html is the page template;
  • src/index.js is the JavaScript entry point.

You can delete or rename the other files.

You may create subdirectories inside src. For faster rebuilds, only files inside src are processed by Webpack.
You need to put any JS and CSS files inside src, or Webpack won’t see them.

Tips: Importing a Component

This project setup supports ES6 modules thanks to Babel.
use import and export.

For example:

Button.js - example class component

import React, { Component } from 'react';

class Button extends Component {
  render() {
    // ...
  }
}

export default Button; // Don’t forget to use export default!

DangerButton.js - example functional component

import React, { Component } from 'react';
import Button from './Button'; // Import a component from another file

class DangerButton extends Component {
  render() {
    return <Button color="red" />;
  }
}

export default DangerButton;

Be aware of the difference between default and named exports. It is a common source of mistakes.

We suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use export default Button and import Button from './Button'.

Named exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like.

Tips: Learn more about ES6 modules:

Guide

Full version of the quide for apps created with create-react-app you here.

markdown-editor's People

Contributors

kamilkoterba avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

raksoq

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.