Giter Site home page Giter Site logo

rfx-core's People

Contributors

foxhound87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rfx-core's Issues

Question about dependency upgrades

Is it possible to upgrade react-router dependency from v3 to v4 (what should be done)?
What about mobx? Version 5 exists which has proxy functionality, but as far as I know rfx-core does not support that high mobx version too.

@foxhound87

The UI not update when hot-reload

enviroment:

    "mobx": "^3.2.2",
    "mobx-react": "^4.2.2",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-router-dom": "^4.1.2",
    "rfx-core": "^1.5.3"

entry:

.....
import "./stores" // init the store

const store = rehydrate()
ReactDOM.render(
  <AppContainer>
    <Router>
      <Provider store={isProduction ? store : hotRehydrate()}>
        <App />
      </Provider>
    </Router>
  </AppContainer>,
  document.getElementById('app'))

// hot reload config
if (module.hot) {
	module.hot.accept(() => renderApp(App))
}

@withRouter // make react-router work 
@inject('store')
@observer
export default class App extends Component {
  constructor(props) {
    super(props)
    this.store = this.props.store.appState
  }

  componentDidMount() {
    this.store.setDate('2017-11-11')
  }

  render() {
    return (
      <div className="App">
        <div className="App-header">
          <img src={img} className="App-logo" alt="logo" />
          <h2>Welcome to React {this.store.dateStr}</h2>
        </div>
        <p className="App-intro">
          To get started, edit <code>src/App.js</code> and save to reload. {this.store.testVal}
        </p>
        ..........
    )
  }
}

Store:

export default class AppState {
  @observable testVal

  constructor() {
    this.testVal = '123'
  }
}

import { store } from 'rfx-core'

import AppState from './AppState'

export default store.setup({
  appState: AppState,
  ......
})

After updating Store, for example, change this.testVal = '123' to this.testVal = '1234', the log shows Store has changed, but the UI not updated.

image

Here is the sample project, would you please help to check?
https://github.com/njleonzhang/my-react-starter

hot reload can not work

    window.__STORE = $store.set(JSON.parse(dehydrate(window.__STORE)));

If I have a Date object in Store. then Json.stringify and parse can not handle Date properly, in this scenario, the hotreload can not work.

JSON.stringify({a: new Date()}) ----> "{"a":"2017-08-04T08:08:54.564Z"}"
JSON.parse('{"a":"2017-08-04T08:08:54.564Z"}') ----> Object {a: "2017-08-04T08:08:54.564Z"}

the a is not a Date now, any operation to it will cause exception.

Call store method from another store

Hi,

Is there any way to call a store's method from another store? For instance, I would like to init app after user has logged in. In user store's login callback, I would like to call app stores init function.

Thanks.

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.