1.1.655 • Published 6 years ago

rrsx v1.1.655

Weekly downloads
409
License
-
Repository
github
Last release
6 years ago

Rctx

Example

//Test component
import { importContexts } from 'rctx';
import TestContext from './test-context.ctx';
const TestComponent = props => {
  const { testContext } = props;
  const { add } = testContext;
  return <div onClick={add}>hello world</div>;
};
export default injectContexts(TestComponent, {
  testContext: TestContext
});
	//Test Context
import { ContextComponent createContext ContextStore } from  'rctx';
class  TestContext  extends  ContextComponent{
	state = {value:0}
	add  = () => {
		this.setState(prevState  => {
			return { value:  prevState.value  +  1 };
		});
	}
   }
export  default  createContext(TestContext, { store:  new  ContextStore() /*If you want to preserve the state when component unmount*/ });
//App
import TestContext from './test-context.ctx';
import { importContexts } from 'rctx';
class App extends Component {
  render() {
    return <TestComponent />;
  }
}

export default importContexts(App, [TestContext]);
1.1.655

6 years ago

1.1.654

6 years ago

1.1.653

6 years ago

1.1.652

6 years ago

1.1.651

6 years ago

1.1.65

6 years ago

1.1.649

6 years ago

1.1.648

6 years ago

1.1.647

6 years ago

1.1.646

6 years ago

1.1.645

6 years ago

1.1.644

6 years ago

1.1.643

6 years ago

1.1.642

6 years ago

1.1.641

6 years ago

1.1.640

6 years ago

1.1.639

6 years ago

1.1.638

6 years ago

1.1.637

6 years ago

1.1.636

6 years ago

1.1.635

6 years ago

1.1.634

6 years ago

1.1.633

6 years ago

1.1.632

6 years ago

1.1.631

6 years ago

1.1.630

6 years ago

1.1.629

6 years ago

1.1.628

6 years ago

1.1.627

6 years ago

1.1.626

6 years ago

1.1.625

6 years ago

1.1.624

6 years ago

1.1.623

6 years ago

1.1.622

6 years ago

1.1.621

6 years ago

1.1.620

6 years ago

1.1.619

6 years ago

1.1.618

6 years ago

1.1.617

6 years ago

1.1.616

6 years ago

1.1.615

6 years ago

1.1.614

6 years ago

1.1.613

6 years ago

1.1.612

6 years ago

1.1.611

6 years ago

1.1.61

6 years ago

1.1.60

6 years ago

1.1.59

6 years ago

1.1.589

6 years ago

1.1.588

6 years ago

1.1.587

6 years ago

1.1.586

6 years ago

1.1.585

6 years ago

1.1.584

6 years ago

1.1.583

6 years ago

1.1.582

6 years ago

1.1.581

6 years ago

1.1.58

6 years ago

1.1.57

6 years ago

1.1.56

6 years ago

1.1.55

6 years ago

1.1.54

6 years ago

1.1.53

6 years ago

1.1.52

6 years ago

1.1.51

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago