
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
react-lingost
Advanced tools
npm install react-lingost
./lingost/ Directory and create ./lingost/index.js and write belowimport { createState } from 'react-lingost'
let user = createState('user', {
logged: false,
data:{},
test:[1,2,3,4],
})
module.exports = {
user,
}
react-lingost moduleimport { passStateToProps } from 'react-lingost'
function stateToProps( { user } ) {
return {
logged: user.logged,
test: user.test[0]
}
}
export default passStateToProps(stateToProps)(App)
import { user } from './lingost/index.js'
...
user.setState({
logged: true
}) // update state and reRender
let user = createState('user', {
logged: false,
data:{},
test:[1,2,3,4],
})
function stateToProps( { user } ) {
return {
logged: user.logged,
test: user.test[0]
}
}
export default passStateToProps(stateToProps)(App)
user.setState({
test:[1,2,3]
})
/*
이 경우에는 setState를 호출해도 re-Rendering 되지 않습니다.
App은 { test: user.test[0] } 를 참조하고 있는데
위의 setState를 호출하더라도 user.test[0]의 결과는 바뀌지 않기 때문입니다.
In this case, calling setState does not re-render.
App refers to {test: user.test [0]}
This is because calling setState does not change the result of user.test [0].
*/
// dont use below, it will not working
function stateToProps( state ) {
return { state }
}
// you can use,
function stateToProps({ user }) {
return { nickname: user.nickname }
}
// or
function stateToProps(state) {
return { nickname: state.user.nickname }
}
// `function stateToProps()` 에서 사용되는 state값은 항상 'String', 'Number', 'Boolean' 형태여야합니다
// The state value used in `function stateToProps ()` should always be of type 'String', 'Number', 'Boolean'
// `return {user: state.user}` 처럼 'Object'를 반환하지 말고, `return {nickname: state.user.nickname}`처럼 'String', 'Number', 'Boolean'를 반환하세요.
// `return { user:{ nickname: state.user.nickname } }` 이런 형태도 가능합니다.
// state를 사용한 값에 대해서만 'String', 'Number', 'Boolean'가 반환되게 해주세요.
// Do not return 'Object' like `return {user: state.user}`, but return 'String', 'Number', 'Boolean' like `return {nickname: state.user.nickname}`
// `return {user: {nickname: state.user.nickname}}` This type is also possible.
// Just let 'String', 'Number', 'Boolean' be returned for values using state.
LangReloader in react-g-lang.react-g-lang의 LangReloader와 같은, component wrapper function과 함께 쓰기
import { setLanguage, setLanguages, onChangeLanguage } from 'g-lang'
import { lang, LangReloader } from 'react-g-lang'
export default LangReloader(App)
import { setLanguage, setLanguages, onChangeLanguage } from 'g-lang'
import { lang, LangReloader } from 'react-g-lang'
import { createState, passStateToProps, useMiddleware } from 'react-lingost'
useMiddleware(LangReloader) // <<== add this
export default passStateToProps(App)
import { createState } from 'react-lingost'
// make state
let user = createState('stateName', { title:'abcd' })
//
/*
`user` variable has the following methods
setState
notReRenderedInRealtimeState
*/
import { passStateToProps } from 'react-lingost'
const stateToProps = ( { stateName } ) => ({
title: stateName.title
})
const __Test1 = (props)=>(<Text>{props.name}</Text>)
const Test1 = passStateToProps( stateToProps )( __Test1 )
// <Test1 /> Component will be <Test1 title='abcd' />
user.setState({ title:'abcde' })
// The above code will replace <Test1 title='abcd' /> with <Test1 title='abcde' />
user.setState({ descripiton:'hi' })
// The above code will not re-render <Test1 />, because Test1 does not refer to stateName.description
FAQs
Best Static-Outer-State For React
The npm package react-lingost receives a total of 20 weekly downloads. As such, react-lingost popularity was classified as not popular.
We found that react-lingost demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.